Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 04-13-2005, 08:46 PM Simple line
simjay's Avatar
Experienced Talker

Posts: 31
Location: UK
Trades: 0
Hello can any one help with this one? There is only one line of code that does not work!!!!




PHP Code:
        $sql = "SELECT * FROM adddb WHERE nameof LIKE '$comment' ORDER BY nameof";
        
$result = mysql_query($sql, $conn) or die(mysql_error());
while ($newArray = mysql_fetch_array($result)) {
     
    $nameof = $newArray['nameof'];
    $why = $newArray['why'];
        
    echo "  
    <b>Name:</b><br>             
    $nameof<br><br>
    <b>Why?</b><br>$why<br>";
}
?>



         <?php
    
        
[B]$sql "SELECT * FROM comments WHERE nameid = '$nameof'";[/B
// This One
$result mysql_query($sql$conn) or die(mysql_error());
while (
$newArray mysql_fetch_array($result)) {
     
    
$user $newArray['user'];
    
$comment $newArray['comment'];

    echo 
"  
    <b>Name:</b><br>             
    
$user<br><br>
    <b>Comments:</b><br>  
    
$comment<br><hr>";
}
?>
__________________

Please login or register to view this content. Registration is FREE
- Hosting From £9.99PY 500MB Space - 10GB Bandwidth - Domains From £8.00PY
simjay is offline
Reply With Quote
View Public Profile Visit simjay's homepage!
 
 
Register now for full access!
Old 04-13-2005, 08:53 PM
Novice Talker

Posts: 9
Trades: 0
Care to tell us in what way it doesn't work?
MarkyH is offline
Reply With Quote
View Public Profile
 
Old 04-13-2005, 09:05 PM
dotcomguy's Avatar
Skilled Talker

Posts: 89
Location: Manchester, UK
Trades: 0
which line? and whats the error?
__________________

Please login or register to view this content. Registration is FREE
from just $1.85 per post.
dotcomguy is offline
Reply With Quote
View Public Profile Visit dotcomguy's homepage!
 
Old 04-13-2005, 09:06 PM
Phaedrus's Avatar
Ultra Talker

Posts: 271
Location: CA
Trades: 0
My quick guess is this one:
PHP Code:
[B]$sql "SELECT * FROM comments WHERE nameid = '$nameof'";[/B
__________________

Please login or register to view this content. Registration is FREE
Phaedrus is offline
Reply With Quote
View Public Profile
 
Old 04-13-2005, 09:13 PM
dotcomguy's Avatar
Skilled Talker

Posts: 89
Location: Manchester, UK
Trades: 0
remove the [ b ] and [ / b ]
__________________

Please login or register to view this content. Registration is FREE
from just $1.85 per post.
dotcomguy is offline
Reply With Quote
View Public Profile Visit dotcomguy's homepage!
 
Old 04-13-2005, 09:19 PM
0beron's Avatar
Defies a Status

Posts: 1,832
Location: Somewhere else entirely
Trades: 0
er, I think they were trying to point out with bbcode that that was the offending line. You can't nest bold tags inside the [php ] tags. Also the comment //this one is a dead giveaway.

I can't see much wrong with the SQL itself - what problem are you having? Does it just not select anything?
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';

Please login or register to view this content. Registration is FREE
(aka MSN handwriting for forums)
0beron is offline
Reply With Quote
View Public Profile Visit 0beron's homepage!
 
Old 04-13-2005, 09:37 PM
Phaedrus's Avatar
Ultra Talker

Posts: 271
Location: CA
Trades: 0
Oh yeah I see it now, lol like I said it was a quick guess. Simjay, any information you could give as to what error you're getting would help. The answer you get is only as good as the information you give.
__________________

Please login or register to view this content. Registration is FREE
Phaedrus is offline
Reply With Quote
View Public Profile
 
Old 04-14-2005, 04:53 PM
rvarcher's Avatar
Novice Talker

Posts: 5
Location: OKC, OK
Trades: 0
Where you have LIKE '$comment' are you really wanting LIKE '%$comment' or LIKE '$comment%' or even LIKE '%$comment%'. Don't you want a wildcard in there if you're using LIKE?
rvarcher is offline
Reply With Quote
View Public Profile Visit rvarcher's homepage!
 
Old 04-15-2005, 01:58 PM
simjay's Avatar
Experienced Talker

Posts: 31
Location: UK
Trades: 0
well all it has to do is display information from the database where nameid = $nameof in the nameid the data would be John Jackson. it only works if nameid = 0.
__________________

Please login or register to view this content. Registration is FREE
- Hosting From £9.99PY 500MB Space - 10GB Bandwidth - Domains From £8.00PY
simjay is offline
Reply With Quote
View Public Profile Visit simjay's homepage!
 
Reply     « Reply to Simple line
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.21802 seconds with 12 queries