Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.