0

Is this code correct?

It is supposed to get input from SMS messaging API and save it to database. Mysql database is created with Table inbox and 2 columns called ID & Msg.

I want to know if this code is going to do the job? Else help me in correcting the code.

Thanks in advance...

Regards,
Righthe.

<?php

// database
$db_host = “localhost”;
$db_user = “username”;
$db_pass = “password”;
$db_name = “database name”;

// connect to mysql
$link = mysql_pconnect ($db_host, $db_user, $db_pass) or die (“can’t connect”);
mysql_select_db ($db_name) 0or die (“can’t select database”);
$msg = trim($msg);

//input to table inbox
$sql = “INSERT INTO inbox
SET id=”,
msg=’$msg’”;
$query = mysql_query($sql) ;
?>

2
Contributors
5
Replies
6
Views
6 Years
Discussion Span
Last Post by Righthe
0

No, this code is not correct. While 0or seems to be a typo, the insert syntax is wrong. The id parameter is lacking a value.

0

Hi Smantscheff,

I have corrected those, but still i have Parse error: parse error in C:\wamp\www\index.php on line 10
$link = mysql_pconnect ($db_host, $db_user, $db_pass) or die (“can’t connect”);

I am not knowing what is the possible problem in this. Request help...

Regards,
Righthe.

0

Its an PHP error.

Below is the error displayed in browser

Parse error: parse error in C:\wamp\www\index.php on line 10

Edited by Righthe: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.