Quick SQL help
- Started
- Last post
- 16 Responses
- Ginja
I have an error in this but have no idea what it is...
I'm learning from a tutorial and done exactly what it says...
Is there something wrong?
while( $row = mysql_fetch_array( $rs ) )
- superjuice0
can you post a link to the tutorial, and maybe the site you are working on? - not enough info provided to help.
- UndoUndo0
no ";" at the end of the line
- toastie0
what's the error? and post more code
- BZZZP0
and use mysql_fetch_assoc if yer gonna use field names. less data shuffle
- Ginja0
I bought a book so cant give a link sorry.
Error is... mysql_fetch_array(): supplied argument is not a valid MySQL result resource
More code:
while( $row = mysql_fetch_array( $rs ) )
{
echo( "Movie: " . $row["movietitle"] ."");
echo( "Person & Number: " . $row["person"] ." - " . $row["number"] ."");
echo( "Extra Info: " . $row["description"] ."");
}
- UndoUndo0
check yr query, ($rs line)
can you post it?
and a semi colon to the end of the line as stated
- BZZZP0
i bet the fucknut isn't putting a query result into $rs
- Ginja0
$rs = mysql_query( $sql,$conn );
$sql="select movietitle, person, number, description from joshrco_movnumbers";
conn is the connection stuff which works
but there is another $rs = above the query one, does that matter.
- BZZZP0
do this:
$rs = mysql_query( $sql,$conn ) or die (mysql_error());
- Ginja0
it says tablename.tablename doesnt exist
- BZZZP0
well, then
that would sure essplain why you get no sql result, huh?
this looks fishy: tablename.tablename
... it should be just tablenamepost your freakin query.
- Ginja0
I sent you email BZZZP with the file attached.
- BZZZP0
you -like- being difficult, don't you?
not checking that account from here,
resend:
- UndoUndo0
dont call a table "number" sql wont like it. use some thing like 'id' instead,
BZZZP be geantle dude, we all started to learn from somewhere
- BZZZP0
this is me being gentle, undo.
- UndoUndo0
:)