View Full Version : PHP Error
Dentafrice1
26-03-2006, 01:29 PM
In My Dj Panel My Dj Says is *****ing up
Heres the error:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/habbonew/public_html/dj_staff/says.php on line 3
Heres my page code
<?php
$query = mysql_query("SELECT * FROM users WHERE username = '$logged[username]'");
$row = mysql_fetch_array($query);
echo "<b>".$row["username"]."</b></br>";
echo "<i>Says, ".$row["comment"]."</i><br><br>";
?>
Whats wrong
timROGERS
26-03-2006, 01:30 PM
There's a problem with $query
Dentafrice1
26-03-2006, 01:35 PM
<?php
$query = mysql_query("SELECT * FROM 'shoutout'");
$row = mysql_fetch_array($query);
echo "<b>".$row["username"]."</b></br>";
echo "<i>Says, ".$row["comment"]."</i><br><br>";
?>
There it is now What is the problem with query?
craigg.
26-03-2006, 01:50 PM
<?php
$query = mysql_query("SELECT * FROM users WHERE username = '$logged[username]'");
$row = mysql_fetch_array("$query");
echo "<b>".$row["username"]."</b></br>";
echo "<i>Says, ".$row["comment"]."</i><br><br>";
?>
Also your second post is the same as the first?
Try that what I have ^
- Craig.
Dentafrice1
26-03-2006, 01:53 PM
<?php
$query = mysql_query("SELECT * FROM 'shoutout'");
$row = mysql_fetch_array($query);
echo "<b>".$row["username"]."</b></br>";
echo "<i>Says, ".$row["comment"]."</i><br><br>";
?>
I edited it ;) i pasted the wrong thing
But can you help?? Theres something wrong :(
Eric30
26-03-2006, 01:59 PM
<?php
$query = mysql_query("SELECT * FROM `shoutout`");
$row = mysql_fetch_array($query);
echo "<b>".$row["username"]."</b></br>";
echo "<i>Says, ".$row["comment"]."</i><br><br>";
?>
There ya go ;)
$query = mysql_query('SELECT * FROM users WHERE username = \''.$logged[username].'\'');
Dentafrice1
26-03-2006, 02:41 PM
TY Plus rep to both of you
Splinter
26-03-2006, 02:54 PM
Wheres the connection? Also just change the $logged['username'] to ".$logged['username']." and it should be ok. Also instead of just using $row = mysql_fetch_array($query);
its best to use:
while($row = mysql_fetch_array($query)) {
echo "RESULTS HERE ;)";
}
Eric30
26-03-2006, 06:03 PM
Wheres the connection? Also just change the $logged['username'] to ".$logged['username']." and it should be ok. Also instead of just using $row = mysql_fetch_array($query);
its best to use:
while($row = mysql_fetch_array($query)) {
echo "RESULTS HERE ;)";
}
What would display everything in the table, as this is for a 'DJ Says' he would only need to display the last row.
Dentafrice1
26-03-2006, 06:08 PM
TY
Thread Closed
Want to hide these adverts? Register an account for free!
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.