Re: Newbie: Help on mySQL !!!
| From: | Ralph Alberti | Date: | Mon, 12 Mar 2001 04:26:47 +0000 |
| Subject: | Re: Newbie: Help on mySQL !!! | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-5948@lists.php.net to get a copy of this message | ||
I'm pretty new at php too but I think you are going about it all wrong.
First create a php script that accesses MySQL.
Like this:
<?php
$connection = mysql_connect("localhost","username","password");
if (!$connection) { echo "Couldn't make a connection!"; exit; }
$db = mysql_select_db("dbname", $connection);
if (!$db) { echo "Couldn't select database!"; exit; }
$sql = "SELECT * FROM tablename WHERE field LIKE '$fieldname'";
$sql_result = mysql_query($sql,$connection);
...
?>
Then put it on your web tree.
Then point to it with your browser.
I think you can execute a php script from the command line but I'm not
sure. I haven't done it.
--Ralph
Mujahid wrote:
>
> Hi,
>
> I been working on PHP/MySQL on Windows and to run some database script on
> MySQL, at the DOS command prompt I say
>
> >> mysql -u root -p < myscript.txt
>
> to run my script of inserts.
>
> Can anybody help me with an equlent at linux prompt ?
>
> TIA
>
> --
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net
> For additional commands, e-mail: php-windows-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net