Suddenly having trouble..

This is a discussion on "Suddenly having trouble.." within the PHP Forum section. This forum, and the thread "Suddenly having trouble.. are both part of the Program Your Website category.



 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1  
Old Aug 4th, 2006, 21:26
Junior Member
Join Date: Jun 2006
Location: CA
Age: 21
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Suddenly having trouble..

I really don't get this.. however I had this script working flawlessly yesturday, and I went to change a couple things, and now suddenly it's not working properly. I am entirely confused as to why, because as far as I know, I didn't change a single thing. But here it is.. lemme know if you guys see anything wrong. Otherwise I'll have to assume something's up with my DB..

Code: Select all
<?php
    $query = "SELECT * FROM `EMPLOYEES` where loginName='$logname'";
        $result = mysql_query($query) or die(mysql_error());
        while ($text = mysql_Fetch_assoc($result)); {
            echo ''.$text['name'].'<br>
            '.$text['phone'].'<br>
            '.$text['email'].'';
            }
?>

<?php
    $query = "SELECT * FROM `Techs` where name='$Tech'";
        $result = mysql_query($query) or die(mysql_error());
        while ($text = mysql_Fetch_assoc($result)); {
            echo ''.$text['Name'].'<br>
            '.$text['Phone'].'<br>
            '.$text['Email'].'';
            }
?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Aug 4th, 2006, 22:29
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Suddenly having trouble..

First problem is case sensitivity.
Code: Select all
while ($text = mysql_Fetch_assoc($result)); {
Both of these lines in your code have a uppercase 'F' which should be lowercase.

Second problem.
Code: Select all
$query = "SELECT * FROM `EMPLOYEES` where loginName='$logname'";
In both these line, you don't need the single quotes around the table name and I prefer coding like;
Code: Select all
...loginName='".$logname."'";
Potential third problem.
Code: Select all
echo ''.$text['name'].'<br>
         '.$text['phone'].'<br>
         '.$text['email'].'';
Unless you did this when you posted the code, PHP will think you have unterminated lines, etc.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Aug 4th, 2006, 23:28
Junior Member
Join Date: Jun 2006
Location: CA
Age: 21
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Suddenly having trouble..

Aye, it was kind of a combination of all the above. However the single quotes around the table name are actually backticks.. not necessary in most cases, but I tend to use them to be precautionary.

Thanks a lot!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Aug 9th, 2006, 11:58
Up'n'Coming Member
Join Date: Jun 2006
Location: Rochester, NY
Posts: 67
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Suddenly having trouble..

SELECT * FROM `EMPLOYEES` where loginName='$logname


i always used the thought ``='' like `loginName`='$logname'

(do that incase you ever have a column named table or where or any mysql commands, so it doesnt get confused.

also, never capitalize columns or you will get very confused.
__________________
www.MonsterCoding.com - Website Programming and Development Services
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
suddenly, having, trouble

Thread Tools

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Having trouble with PHP voodoo465 PHP Forum 5 Feb 20th, 2007 21:47
Browser trouble? sheltomlee Starting Out 4 Jan 28th, 2007 21:47
CGI Trouble Maverick25r Other Programming Languages 0 Jul 31st, 2006 18:24
js menu suddenly disappeared in ie mendel69 JavaScript Forum 7 Jul 31st, 2006 17:16
Text suddenly awful in Photoshop 7 autumn_whispers2me Graphics and 3D 4 Jun 12th, 2006 12:51


All times are GMT. The time now is 16:31.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42