Portal Home > Knowledgebase > Articles Database > PHP Problem
PHP Problem
Posted by RoyalDesigns, 06-26-2008, 10:37 PM |
When I tried to put the script on my index.php page, I get an error looking like this:
This is line 22, is there something wrong?:
Also, I'm not really good at FTP...so is it bad to use the file manager on the cPanel? If not, where do I go to upload an image on the main index page?
Thanks.
|
Posted by PNH-Madih, 06-26-2008, 11:07 PM |
It will be like this:
$get=mysql_query("SELECT count(id) FROM login WHERE user='$user' and pass='$pass'");
The coma was missing after $pass in your coding.
|
Posted by PNH-Madih, 06-26-2008, 11:10 PM |
By using FTP it is very easy to uplaod.
Just use some ftp client and uplaod your pages.
|
Posted by BurakUeda, 06-26-2008, 11:26 PM |
I think you didn't put a semi-colon at the end of line 21?
paynhost is right about your SQL string, but that will throw a MySQL error, not a PHP error.
|
Posted by RoyalDesigns, 06-26-2008, 11:28 PM |
Thanks, right now I'm using 'File Manager' on the cPanel....but see I added the extra comma there but it still gives me the error. But when I use the HTML editor it provides on cPanel the actual scripts works...doesn't make sense right?
There's a space for line 21. Between line 20, and 22 there's nothing but a space.
|
Posted by stanosf, 06-26-2008, 11:29 PM |
in case it is not clear from the text, it is a closing single quote that paynhost is referring to.
|
Posted by RoyalDesigns, 06-26-2008, 11:35 PM |
I tried that, still no good...
|
Posted by BurakUeda, 06-26-2008, 11:36 PM |
If line 21 is empty, go to the non-empty line before 22 and check the semi-colon or other syntax error. Or better, just post that line here too.
|
Posted by RoyalDesigns, 06-26-2008, 11:45 PM |
That's line 20,21,22.
21 is an empty space. See any problems?
|
Posted by BurakUeda, 06-26-2008, 11:56 PM |
Seems normal to me.
Never used cPanel's file manager but probably it escapes the quotes when saving to server?
You really should use a FTP client to upload your code.
Like FileZilla, ALFTP
And you should fix your SQL string as paynhost said, or you will not get anything from database.
|
Posted by RoyalDesigns, 06-27-2008, 12:05 AM |
I got CoffeeCup FTP, is that good?
And, what error do you see with my SQL string?
Also,
I know what's wrong I think, my script is called cookielogin.html, I was making the page called index.php, it wasn't working.
So, I just made the extension cookielogin.html, but when I renamed the file to index.php it still doesn't work...
Last edited by RoyalDesigns; 06-27-2008 at 12:14 AM.
|
Posted by RoyalDesigns, 06-27-2008, 12:35 AM |
Ah! I found the problem, the extension has to be HTML? Why is that? "Index.html" works but "Index.php" doesn't?
|
Posted by Codebird, 06-27-2008, 02:47 AM |
get=mysql_query("SELECT count(id) FROM login WHERE user='$user' and pass='$pass ' ");
you see the bold thing at the end of the query that is your problem put a single quote before the double quotes.
and as ftp client you can just use fireftp (firefox extension)
|
Posted by PNH-Madih, 06-27-2008, 05:10 AM |
I told the same thing by giving the first reply.
|
Posted by rankris, 06-27-2008, 06:07 AM |
hmm seems like im also with the same pb
|
Posted by Codebird, 06-27-2008, 06:12 AM |
I know but seems like he's not seeing it or something I don't know
|
Posted by greg2007, 06-28-2008, 03:13 PM |
As said a few times, even before you posted that, you don't close your quotes correctly.
You have a double quote " as required before the SELECT, and also after the $pass you have the " to close and wrap that whole statement
But you open the $pass with the single quote ' and then dont close $pass with the single quote '
hmlt file extention wont run php code in it.
It will be expecting html and nothing else, so will output any php as text (unless there is a tag of some kind amongst it)
To run PHP code you have to use a .php file extention (or use a .htaccess file to change it, but thats something else)
|
Add to Favourites Print this Article
Also Read
Dathorn Good? (Views: 580)