Jump to content

[SOLVED] I have some code linked to mysql ect but the data will not insert into mysql


jbulmer09

Recommended Posts

<?php

$con = mysql_connect("connection","username","database");

if (!$con)

  {

  die('Could not connect: ' . mysql_error());

  }

mysql_select_db("database", $con);

$numbers = $_REQUEST['sendto'];

$from = $_REQUEST['from'];

$smsmsg = $_REQUEST['smsmsg'];

$phonechunks = explode(",", $numbers);

$e = count($phonechunks);

for ($i=0; $i<$e; $i++)

{

$rawdata = "$phonechunks[$i]";

$placeholders = array('+', ' ');

$vals = array('', '');

$newdata = str_replace($placeholders, $vals, $rawdata);

mysql_query("INSERT INTO send (sendto, smsfrom, smsmsg)

VALUES ('$newdata', '$from', '$smsmsg')");

}

?>

Can any one spot the mistake?

Could be anywhere, why don't you try and actually debug your errors to see whats happening? eg;

 

$sql = "INSERT INTO send (sendto, smsfrom, smsmsg) VALUES ('$newdata', '$from', '$smsmsg')";
if (!mysql_query($sql)) {
  echo mysql_error() . "<br>" . $sql;
}

]

ok ill do this now, just to add the row is created just no info inserted inside it

 

edit: Query was empty is the out come of that but i dont understand why, when i echo the variables that i would like to insert into the data base they show

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.