Stumped with SQL - please help.

12-04-07, 04:23 PM
|
|
Newbie Coder
|
|
Join Date: Mar 2007
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Stumped with SQL - please help.
I've been googling and I'm stumped.
This seems to return:
What is going on here? Why doesn't it return the SINGLE matching result to those queries?
Last edited by Nico; 12-04-07 at 05:00 PM.
|

12-04-07, 04:25 PM
|
 |
Newbie Coder
|
|
Join Date: Dec 2007
Location: Springfield, MO
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
$Title is going to be an array more than likely. Try this:
You should probably call an element out of $Title, such as $Title['element1'], $Title['element2'], etc.
To clarify things, look in your table (whatever the table is being queried with $query above) and see what columns there are. Each column will be the actual 'element' - Sorry if I'm confusing you heh
__________________
Knowledge Is Power And Without Power, You're Nobody. -Self
Last edited by robertark; 12-04-07 at 04:32 PM.
|

12-04-07, 04:37 PM
|
|
Newbie Coder
|
|
Join Date: Mar 2007
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
That fixes the titles being echoed ($Title[0], etc), but the URL and other mysql_query lines still return Resource #s.
Quote:
|
Sorry if I'm confusing you heh
|
HAO I USE ARAYS? Seriously, come on.
Last edited by Nico; 12-04-07 at 05:00 PM.
|

12-04-07, 04:42 PM
|
 |
Newbie Coder
|
|
Join Date: Dec 2007
Location: Springfield, MO
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Print your results and see what they are, if that fails, try var_dump();
__________________
Knowledge Is Power And Without Power, You're Nobody. -Self
|

12-04-07, 04:44 PM
|
|
Newbie Coder
|
|
Join Date: Mar 2007
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Yeah, it occured to me - they dump as
|

12-04-07, 04:49 PM
|
 |
Newbie Coder
|
|
Join Date: Dec 2007
Location: Springfield, MO
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Without knowing your MySQL table setup, it's a pain to figure out where the problem may be coming from. Your PHP is right, however, go through your MySQL tables and confirm that each column you're calling (Description, Price, etc) actually exists and is non-null.
__________________
Knowledge Is Power And Without Power, You're Nobody. -Self
|

12-04-07, 04:51 PM
|
 |
Newbie Coder
|
|
Join Date: Dec 2007
Location: Springfield, MO
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
What is your $query (in the while loop) - Show me that first, please 
__________________
Knowledge Is Power And Without Power, You're Nobody. -Self
|

12-04-07, 04:55 PM
|
|
Newbie Coder
|
|
Join Date: Mar 2007
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
They all exist and are non-null. Query is Nico: No SQL error is given; the query executes successfully, just doesn't return right.
Table creation structure:
sql Code:
CREATE TABLE `offers` ( `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, `date` varchar(255) NOT NULL DEFAULT '', `Title` varchar(255) NOT NULL DEFAULT '', `URL` varchar(255) NOT NULL DEFAULT '', `Country` varchar(200) NOT NULL DEFAULT '', `Description` varchar(255) NOT NULL DEFAULT '', `price` varchar(255) NOT NULL DEFAULT '', `offerid` text, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=90 ;
Last edited by Nico; 12-04-07 at 05:01 PM.
|

12-04-07, 04:57 PM
|
 |
Level II Curmudgeon
|
|
Join Date: Dec 2004
Posts: 3,027
Thanks: 14
Thanked 35 Times in 33 Posts
|
|
Quote:
Originally Posted by Sparky222B
HAO I USE ARAYS? Seriously, come on.
|
Here is how you use arrays:
http://us2.php.net/array
Last edited by End User; 12-04-07 at 05:00 PM.
|

12-04-07, 04:59 PM
|
 |
Newbie Coder
|
|
Join Date: Dec 2007
Location: Springfield, MO
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
Originally Posted by Sparky222B
They all exist and are non-null. Query is Nico: No SQL error is given; the query executes successfully, just doesn't return right.
Table creation structure:
|
Try this:
Then from there, you could do something like:
Is this what you're trying to do?
__________________
Knowledge Is Power And Without Power, You're Nobody. -Self
Last edited by robertark; 12-04-07 at 05:01 PM.
Reason: SELECT * FROM offers
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|