TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 12-31-2007, 05:51 PM   #1 (permalink)
The Addict
 
webtuto's Avatar
 
Join Date: Dec 2007
Location: morocco
Posts: 221
Thanks: 19
webtuto is on a distinguished road
Bug [sos] a dumb question for sur

hi well im trying to do a news script wih categories of course
but for exemple in categorie named => TALKPHP
i did a page for news about this categorie like that

PHP Code:
$query "select * from table_name where group='TALKPHP' "
group is a colomn or (champ) in frensh i dont know if u call it colomn in english lol
when i test it gaves me an error and when i delete the part "where group='TALKPHP'" the script works very well
so whats the problem
Send a message via MSN to webtuto Send a message via Yahoo to webtuto Send a message via Skype™ to webtuto
webtuto is offline  
Reply With Quote
Old 12-31-2007, 06:07 PM   #2 (permalink)
The Contributor
 
dschreck's Avatar
 
Join Date: Nov 2007
Location: California
Posts: 82
Thanks: 0
dschreck is on a distinguished road
Default

Quote:
Originally Posted by webtuto View Post
...
when i test it gaves me an error and when i delete the part "where group='TALKPHP'" the script works very well
so whats the problem
what's the error that it gives you?
dschreck is offline  
Reply With Quote
Old 12-31-2007, 06:08 PM   #3 (permalink)
The Addict
 
webtuto's Avatar
 
Join Date: Dec 2007
Location: morocco
Posts: 221
Thanks: 19
webtuto is on a distinguished road
Default

when i go back home ill test and tell u the error thanks for replying
Send a message via MSN to webtuto Send a message via Yahoo to webtuto Send a message via Skype™ to webtuto
webtuto is offline  
Reply With Quote
Old 12-31-2007, 07:58 PM   #4 (permalink)
The Acquainted
 
Join Date: Sep 2007
Location: Arizona
Posts: 114
Thanks: 10
Andrew is on a distinguished road
Default

Well, make sure 'TALKPHP' group exists, first. If it does, just double check your names for everything.

Aussi, 'column' est 'champ' en Anglais.
Send a message via AIM to Andrew Send a message via MSN to Andrew
Andrew is offline  
Reply With Quote
Old 12-31-2007, 09:22 PM   #5 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

PHP Code:
$group 'TALKPHP';
$sql sprintf("SELECT * FROM `table_name` WHERE `group` = '%s'"mysql_real_escape_string($group));

$query mysql_query($sql);

if(
$query) {
     echo 
'Woho! The query worked..';
}

else {
     echo 
'DooH! The query did not work..';

Try that!
Tanax is offline  
Reply With Quote
Old 01-01-2008, 01:13 AM   #6 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

...And in addition to Tanax's post. If you're new to sprint, printf, et cetera, then we do have a nice article about them right here. I'm all ears for the error it gives you though.
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
The Following User Says Thank You to Wildhoney For This Useful Post:
codefreek (01-01-2008)
Old 01-01-2008, 01:08 PM   #7 (permalink)
The Addict
 
webtuto's Avatar
 
Join Date: Dec 2007
Location: morocco
Posts: 221
Thanks: 19
webtuto is on a distinguished road
Default

Quote:
Originally Posted by dschreck View Post
what's the error that it gives you?
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\wamp\www\news\cat_info.php on line 5

Send a message via MSN to webtuto Send a message via Yahoo to webtuto Send a message via Skype™ to webtuto
webtuto is offline  
Reply With Quote
Old 01-01-2008, 01:11 PM   #8 (permalink)
The Addict
 
webtuto's Avatar
 
Join Date: Dec 2007
Location: morocco
Posts: 221
Thanks: 19
webtuto is on a distinguished road
Default

Quote:
Originally Posted by Tanax View Post
PHP Code:
$group 'TALKPHP';
$sql sprintf("SELECT * FROM `table_name` WHERE `group` = '%s'"mysql_real_escape_string($group));

$query mysql_query($sql);

if(
$query) {
     echo 
'Woho! The query worked..';
}

else {
     echo 
'DooH! The query did not work..';


Try that!
i try it and here is the answer => DooH! The query did not work..

here is the full code of this page
PHP Code:
<?php
include("config.php");
$group 'TALKPHP';
$sql sprintf("SELECT * FROM `table_name` WHERE `group` = '%s'"mysql_real_escape_string($group));
$res mysql_query($sql) ;

if(
$res) {
     echo 
'Woho! The query worked..';
}

else {
     echo 
'DooH! The query did not work..';
}  

while (
$row mysql_fetch_array($res) ) {
  echo 
"id : ".$row[id]."<br>" ;
  echo 
"titre : ".$row[title]."<br>" ;
  echo 
"resumé : ".$row[resume]."<br>" ;
  echo 
"note : ".$row[rate]."<br>" ;
  echo 
"écris le ".$row[date]."<br>" ;

?>
Send a message via MSN to webtuto Send a message via Yahoo to webtuto Send a message via Skype™ to webtuto
webtuto is offline  
Reply With Quote
Old 01-01-2008, 01:13 PM   #9 (permalink)
The Addict
 
webtuto's Avatar
 
Join Date: Dec 2007
Location: morocco
Posts: 221
Thanks: 19
webtuto is on a distinguished road
Default

Quote:
Originally Posted by Andrew View Post
Well, make sure 'TALKPHP' group exists, first. If it does, just double check your names for everything.

Aussi, 'column' est 'champ' en Anglais.
you must be good in frensh lol thanks for the word colomn
and group is the exact name of the colomn i even copy it and past it in my code
Send a message via MSN to webtuto Send a message via Yahoo to webtuto Send a message via Skype™ to webtuto
webtuto is offline  
Reply With Quote
Old 01-01-2008, 01:20 PM   #10 (permalink)
The Addict
 
webtuto's Avatar
 
Join Date: Dec 2007
Location: morocco
Posts: 221
Thanks: 19
webtuto is on a distinguished road
Default

Quote:
Originally Posted by Wildhoney View Post
...And in addition to Tanax's post. If you're new to sprint, printf, et cetera, then we do have a nice article about them right here. I'm all ears for the error it gives you though.
thanks for the article im gonna read it when i finish this script
Send a message via MSN to webtuto Send a message via Yahoo to webtuto Send a message via Skype™ to webtuto
webtuto is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

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


All times are GMT. The time now is 07:04 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design