Go Back   Forum Care Forums > Development Reference Area > Php Development

Reply
 
LinkBack Thread Tools Display Modes
local v remote
Old
  (#1)
blueboy
Guest
 
Posts: n/a
Default local v remote - 06-02-2007, 08:56 PM

On my localhost this works fine

$result= mysql_query("SELECT date_format(date, '%d/%m/%Y') as date, title,
id, display FROM NEWS");
while ($row = mysql_fetch_***oc($result)) {

but on my remote i get a mysql_fetch_***oc(): supplied argument is not a
valid MySQL result resource

Can someone expalin the problem? PHP version problem?
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Re: local v remote
Old
  (#2)
Darren Whitlen
Guest
 
Posts: n/a
Default Re: local v remote - 06-02-2007, 08:56 PM

blueboy wrote:
> On my localhost this works fine
>
> $result= mysql_query("SELECT date_format(date, '%d/%m/%Y') as date, title,
> id, display FROM NEWS");
> while ($row = mysql_fetch_***oc($result)) {
>
> but on my remote i get a mysql_fetch_***oc(): supplied argument is not a
> valid MySQL result resource
>
> Can someone expalin the problem? PHP version problem?


No. It's MySQL problem.
If it works fine locally, then make sure the table structure is the same
on your remote database as it is on your local database.

---
mysql_query("SELECT date_format(date, '%d/%m/%Y') as date, title,
id, display FROM NEWS") or die(mysql_error());
---


Using that die statement will also help while debugging your script as
it will print out any errors that are caused by your SQL statement.
Which you then ask some mysql people if that is the case.


Darren
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: [PHP] local v remote
Old
  (#3)
Robin Vickery
Guest
 
Posts: n/a
Default Re: [PHP] local v remote - 06-02-2007, 08:56 PM

On 31/05/07, blueboy <EMAIL REMOVED> wrote:
> On my localhost this works fine
>
> $result= mysql_query("SELECT date_format(date, '%d/%m/%Y') as date, title, id, display FROM NEWS");


1. check return values, $result should not be false unless there's a problem.
2. if $result is false, check mysql_error() it'll tell you more about
what's gone wrong.

for example:

$result = mysql_query($query) or die(mysql_error());

-robin
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: [PHP] local v remote
Old
  (#4)
Richard Lynch
Guest
 
Posts: n/a
Default Re: [PHP] local v remote - 06-02-2007, 08:56 PM

On Thu, May 31, 2007 4:50 am, blueboy wrote:
> On my localhost this works fine
>
> $result= mysql_query("SELECT date_format(date, '%d/%m/%Y') as date,
> title,
> id, display FROM NEWS");
> while ($row = mysql_fetch_***oc($result)) {
>
> but on my remote i get a mysql_fetch_***oc(): supplied argument is not
> a
> valid MySQL result resource
>
> Can someone expalin the problem? PHP version problem?


The problem is probably that you never even managed to connect to the
MySQL database in the first place...

But it could be something else entirely.

We can't tell you, but you can find out by using the mysql_error()
function a lot.

--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




Contact Us - Forum Care Forums - Archive - Top