Hy,
My english is not the best, so if you don´t understand something,
please ask!
I want to print the content of a mysql-table where a field is a
specified value.
For that i have written some code that works fine. But i don´t want to
rewrite the code everytime the specified value changes, so i tried to
make a function out of my code.
But now, i get a mysql error:
Warning: Supplied argument is not a valid MySQL result resource in
..........\conf ig.php on line 35
I have only added one line before the code:
function selLinkKategori e() {
and i want to call that function with:
selLinkKategori e();
It would be very nice if someone can help me a bit, cause i´m still
learning php, and i don´t see the problem...
Here is the code (line 35 from the error is line 6 here):
function selLinkKategori e() {
$verbindung = mysql_connect($ baseurl, $dbuser, $dbpass);
mysql_select_db ($dbase, $verbindung);
$sql = "SELECT * FROM $links WHERE kategorie = 'tuts'";
$result = mysql_query($sq l, $verbindung);
$num = mysql_num_rows( $result);
$cur = 1;
echo '<table width="727" border="0" align="center" cellspacing="2"
cellpadding="1" class="content" >
<tr>
<td nowrap><font color="#003366" ><b><u>Link</u></b></font></td>
<td nowrap><font color="#003366" ><b><u>Beschrei bung</u></b></font></td>
</tr>';
while ($num >= $cur) {
$row = mysql_fetch_arr ay($result);
$link = $row["link"];
$beschr = $row["beschreibu ng"];
printf ("<tr><td nowrap bgcolor='%s'>$l ink</td>", bgcolor(3));
printf ("<td nowrap bgcolor='%s'>$b eschr</td>", bgcolor(3));
$cur++;
}
echo "</table>";
}
My english is not the best, so if you don´t understand something,
please ask!
I want to print the content of a mysql-table where a field is a
specified value.
For that i have written some code that works fine. But i don´t want to
rewrite the code everytime the specified value changes, so i tried to
make a function out of my code.
But now, i get a mysql error:
Warning: Supplied argument is not a valid MySQL result resource in
..........\conf ig.php on line 35
I have only added one line before the code:
function selLinkKategori e() {
and i want to call that function with:
selLinkKategori e();
It would be very nice if someone can help me a bit, cause i´m still
learning php, and i don´t see the problem...
Here is the code (line 35 from the error is line 6 here):
function selLinkKategori e() {
$verbindung = mysql_connect($ baseurl, $dbuser, $dbpass);
mysql_select_db ($dbase, $verbindung);
$sql = "SELECT * FROM $links WHERE kategorie = 'tuts'";
$result = mysql_query($sq l, $verbindung);
$num = mysql_num_rows( $result);
$cur = 1;
echo '<table width="727" border="0" align="center" cellspacing="2"
cellpadding="1" class="content" >
<tr>
<td nowrap><font color="#003366" ><b><u>Link</u></b></font></td>
<td nowrap><font color="#003366" ><b><u>Beschrei bung</u></b></font></td>
</tr>';
while ($num >= $cur) {
$row = mysql_fetch_arr ay($result);
$link = $row["link"];
$beschr = $row["beschreibu ng"];
printf ("<tr><td nowrap bgcolor='%s'>$l ink</td>", bgcolor(3));
printf ("<td nowrap bgcolor='%s'>$b eschr</td>", bgcolor(3));
$cur++;
}
echo "</table>";
}
Comment