Jump to content

[SOLVED] Sql error...


Demonic

Recommended Posts

Some weird sql error that doesn't happen on XAMMP latest version with PHP 5.2.4

 

$topics = mysql_query("SELECT * FROM `topics` WHERE `fid` = '".$id."' AND `sticky` = '1' ORDER BY `timestamp` DESC LIMIT $limit_start,$total_limit");

 

But it just don't want to work on my linux server with PHP version 5.2.3

 

What exactly am I doing wrong?

Link to comment
https://forums.phpfreaks.com/topic/75974-solved-sql-error/
Share on other sites

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in

 

Works fine on:

 

Paid Server:

PHP version  4.4.7

MySQL version 4.1.22-standard

 

Home Server:

# MySQL 5.0.45

# PHP 5.2.4

# PHP 4.4.7

 

But doesn't want to seem to work on my other paid hosting with:

 

PHP version 5.2.3

MySQL version 4.1.22-standard

Link to comment
https://forums.phpfreaks.com/topic/75974-solved-sql-error/#findComment-384603
Share on other sites

Put a die statement on the query

 

$topics = mysql_query("SELECT * FROM `topics` WHERE `fid` = '".$id."' AND `sticky` = '1' ORDER BY `timestamp` DESC LIMIT $limit_start,$total_limit")or die(mysql_error());

 

I did, how you think I got that error?

 

god wtf i posted the wrong error....

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
Link to comment
https://forums.phpfreaks.com/topic/75974-solved-sql-error/#findComment-384607
Share on other sites

I'm pretty sure you would get that error anyways, plus you didn't add the die statement in your posted code. The error resulted from the mysql_fetch_array() which of course goes along with the query.

 

Echo your query out to make sure the variables are coming out okay.

Link to comment
https://forums.phpfreaks.com/topic/75974-solved-sql-error/#findComment-384610
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.