Jump to content

[SOLVED] PHP and JS.


Lamez

Recommended Posts

I have a few questions.

 

1. How do I use php in the middle of JS

 

for example:

team[2]="<?php include ("example.php"); ?>"; rec[2]="(19-12)";

 

2. How do I call rows form a MySQL table?

 

I remeber the php is like: $_ROW['somthing']

 

but I do not remember, can anyone refresh my memory

-Thanks :D

 

Link to comment
https://forums.phpfreaks.com/topic/88718-solved-php-and-js/
Share on other sites

js code.... <?php $var function; ?> .... js code........

 

 

$sq_hst = "mysql.server";
$sq_unme = "sql.database.user.name";
$sq_pzwrd = "sql.database.password";
$database = "sql.database.name"; //would suggest keeping this line and the 3 above it in a seperate file and just include said file when you need it..

$dbconn = mysql_connect($sq_hst, $sq_unme, $sq_pzwrd) or die("Error: " . mysql_error());
mysql_select_db($database) or die("Could not select database");

$query="SELECT * FROM table.name.on.database";
$result=mysql_query($query) or die ("Error in query: $query. " . mysql_error());

$result1 = mysql_fetch_array( $result );

echo $result1['row.on.table.name'];

mysql_close();

Link to comment
https://forums.phpfreaks.com/topic/88718-solved-php-and-js/#findComment-454331
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.