Jump to content

[SOLVED] a little help needed


Jumba

Recommended Posts

Hi Guys

I need some help with this script.

This one is working perfectly..

 

<?php

// Open Connection To mySQL.
// Replace 'username' and 'password' with appropiate login values for your server.

$mysqlLink = mysql_connect( 'localhost' , 'username' , 'password' );

// Select mySQL Database.

mysql_select_db( 'database_name' , $mysqlLink );

// Create Query To Create Table.

$sql = 'INSERT INTO `table0` (`ID`, `Name`, `Age`) VALUES (NULL, \'Mike\', \'19\');';

// Issue Query.

mysql_query( $sql );

// Close mySQL Connection.

mysql_close( $mysqlLink );

?>

 

 

But I actually was wondering, instead of having to write the info in this code

('INSERT INTO `table0` (`ID`, `Name`, `Age`) VALUES (NULL, \'Mike\', \'19\');';)

 

Isn't there a way to tell php to go to say "data.sql" and execte the queries in that file?

and if it's possible, how do I do it?

 

 

Link to comment
https://forums.phpfreaks.com/topic/46361-solved-a-little-help-needed/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.