Current location: Hot Scripts Forums » Programming Languages » PHP » Weird problem with my MySQL queries...


Weird problem with my MySQL queries...

Reply
  #1 (permalink)  
Old 02-20-09, 05:04 PM
Alex.css's Avatar
Alex.css Alex.css is offline
Newbie Coder
 
Join Date: Nov 2007
Location: Canada
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Weird problem with my MySQL queries...

Hi dear programmers.
I'm a bit confused about my SQL queries problem. To make short, I select something from the database but it doesn't fetch an array, and I don't know why.

The mysql_error() did not show any errors, even if it made the script dying.
I mean, I did : mysql_connect(....) or die(mysql_error()); -> fine
mysql_sel...-> fine
mysql_query-> fine
mysql_fetch_array-> it dies. Showing only a blank page, no error.

This is a part of the script, starting from the beginning :
PHP Code:

<?php
$theme 
$_GET['theme'];
mysql_connect($SQL['hote'], $SQL['utilisateur'], $SQL['motdepasse']);
mysql_select_db($SQL['bdd']);
  
$req1 mysql_query("SELECT * FROM `".$SQL['bdd_prefix']."theme` WHERE `url`='".$theme."'");
  echo 
$req1;
  
$SOMETHING mysql_fetch_array($req1);
  echo 
$SOMETHING['defaut'];
?>
The $_GET['theme'] is for sure containing something, it's already verified.
Mysql_connect works.
mysql Select works.
mysql Query works, returning a resource id (#12)
mysql fetch_array DONT work. Returning nothing.


Thanks in advance, Alex.css
__________________
Alex.css
.:ImperialBB's French Translator:.
Even us aren't able to save ourselves - Anonymous, Japan
Reply With Quote
  #2 (permalink)  
Old 02-20-09, 06:07 PM
landing's Avatar
landing landing is offline
Coding Addict
 
Join Date: Jul 2006
Location: Scotland
Posts: 302
Thanks: 0
Thanked 0 Times in 0 Posts
Try a var_dump($SOMETHING); to see if it's set?
__________________
Always sanitise your data


Best regards
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Weird Problem. domeger PHP 1 08-05-05 02:17 PM
PHP or Mysql problem?? weilies PHP 1 08-01-05 12:29 AM
Problem with Insert in MySql bionicsamir PHP 2 01-02-05 08:08 PM
MySQL Problem. landboy PHP 2 08-11-04 12:46 PM
Load Data Infile Problem (MySQL) Shaky2 PHP 1 03-26-04 04:48 PM


All times are GMT -5. The time now is 08:29 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.