Reply to Re: Getting slew of errors when running php script

Your name:

Reply:


Posted by Gordon Burditt on 06/07/05 23:30

>Hello! Curious if anyone could give me a hand. I wrote this PHP
>script with makes a simple connection to a mysql database called
>firstdb and just pulls back the results and displays on the webpage.
>
>Here is the script.

WHERE ARE THE ERRORS?

>I appreciate any light that could be shed on the script and why I would
>get the errors.

WHERE ARE THE ERRORS? Well, I'll just have to guess what's wrong.

> $host = "localhost";

This is wrong. Your hostname should be in the .nsa.gov top-level domain.
And if you don't have clearance, they'll kill you.

> $user = "root";

Wrong. This should be "Administrator" or "Al Gore".

> $pass = "*******";

Your password is incorrect, and too easy to guess.

> //open a persistant connection to the database

mysql_connect() does not open a *PERSISTENT* connection.

> $connect = mysql_connect($host, $user, $pass);
>
> //Select the database
> mysql_select_db("myfirstdb", $connect);

You don't check whether this worked. Also, it's MyFristDB (as in
the Senator).

>
> //Set and run the query
> $sql = "Select Employee_no, Last_name, First_name, Commission from
>Sales_Representative";

Wrong. This query should be "delete from Sales_Representative where Spams_Sent > 0".

> $result = mysql_query($sql, $connect);
>
> $x = mysql_num_rows($result);
>
> //If the tenth row exists, go straight to it
> if ($x >= 10) {
> mysql_data_seek($result, 9);
> }
>
> //Return the data from the 10th row
> $row = mysql_fetch_array($result);
> Print "Employee_no: " . $row["Employee_No"] . "<br>\n";
> Print "Last_Name: " . $row["Last_Name"] . "<br>\n";
> Print "First_Name: " . $row["First_Name"] . "<br>\n";
> Print "Commission: " . $row["Commission"];

Isn't "print", not "Print" what you are trying to do here?
>
> ?>
>
>
>
></body>
></html>

Gordon L. Burditt

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация