Salut à tous, lors d'une requette pour créer une nouvelle table nommée "task" avec ma page php, je reçois un message d'erreur Mysql qui est le suivant :
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''http://ads.clicmanager.fr/' at line 1
Je vérifie donc dans ma base de donnée, et je vois bien la table crée, mais vide.
Voici le code de la page php :
Merci de votre aide.
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''http://ads.clicmanager.fr/' at line 1
Je vérifie donc dans ma base de donnée, et je vois bien la table crée, mais vide.
Voici le code de la page php :
Code:
<?
if($act=='addvisit')
{
if(!mysql_query("CREATE TABLE task$code (
fnum int (10) unsigned NOT NULL auto_increment,
fip char (20) default NULL,
fid int (10),
fdate date default NULL,
ftime time default NULL,
PRIMARY KEY (fnum)
) TYPE=MyISAM;")) {echo"Ticket deja existant!"; exit;}
$sql=mysql_query("INSERT INTO tasks(fcode,fsize,furl,fsitename,fnote,fvisits,fname,flog,fpass,startdate,enddate,prise,fpaytype) VALUES($code,$size,'$url','$sitename','$note',0,'$name','$login','$password','$sdate','$edate',$prise,'$paytype')") or die(mysql_error());
if(mysql_affected_rows()) echo"Nouvelle campagne de visite ajoutée";
}
?>
<form name="addvisit" method="post" action="">
<table border="0" width="100%" align="center" bgcolor="f5f5f5">
<tr valign="top">
<td colspan="2" bgcolor="#006666"><font color="#FFFFFF"><b><font face="Arial, Helvetica, sans-serif">ADD
Nouvelle campagne clics</font></b></font></td>
</tr>
<tr valign="top">
<td width="53%"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">code:</font></td>
<td width="47%"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<?
if(!mysql_num_rows(mysql_query("SELECT fn AS cod FROM tasks ORDER BY fn DESC"))) $cod=1;
else{
@ extract(mysql_fetch_array(mysql_query("SELECT fn AS cod FROM tasks ORDER BY fn DESC"))); $cod=$cod+1;}
?>
<input type="text" name="code" value="<?echo $cod?>">
<font size="1">(do not change)</font></font></td>
</tr>
<tr valign="top">
<td width="53%"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">campaign
size:</font></td>
<td width="47%"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input type="text" name="size" value="<?if($act=add) echo $ftype?>">
</font></td>
</tr>
<tr valign="top">
<td width="53%"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">campaign
URL:</font></td>
<td width="47%"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input type="text" name="url" value="<?if($act=add) echo $furl?>">
</font></td>
</tr>
<tr valign="top">
<td width="53%"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Site
name:</font></td>
<td width="47%"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input type="text" name="sitename" value="<?if($act=add) echo $fsitename?>">
</font></td>
</tr>
<tr valign="top">
<td width="53%">
<p><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Site description
(<b>or</b> banner image HTML-code):</font><br>
<font color="#FF0000"><b><font size="1">example: <font color="#000066"><img
src=http://site.com/banner.gif></font></font></b></font></p>
</td>
<td width="47%"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<textarea name="note" cols="40" rows="4"><?if($act=add) echo $fnote?></textarea>
</font></td>
</tr>
<tr valign="top">
<td width="53%"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Advertiser's
name:</font></td>
<td width="47%"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input type="text" name="name" value="<?if($act=add) echo $fname?>">
</font></td>
</tr>
<tr valign="top">
<td width="53%"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Advertiser's
login:</font></td>
<td width="47%"> <font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input type="text" name="login">
</font></td>
</tr>
<tr valign="top">
<td width="53%"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Advertiser's
password:</font></td>
<td width="47%"> <font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input type="text" name="password">
</font></td>
</tr>
<tr valign="top">
<td width="53%"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Campaign
start date:</font></td>
<td width="47%"> <font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input type="text" name="sdate">
<font size="1">(YYYY-MM-DD)</font></font></td>
</tr>
<tr valign="top">
<td width="53%"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Campaign
end date:</font></td>
<td width="47%">
<input type="text" name="edate">
<font size="2" face="Verdana, Arial, Helvetica, sans-serif"> <font size="1">(YYYY-MM-DD)</font></font>
</td>
</tr>
<tr valign="top">
<td width="53%"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Pay
for 1 visit:</font></td>
<td width="47%"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input type="text" name="prise" size="4">
<input type="radio" name="paytype" value="points" checked>
<font size="1">POINTS</font>
<input type="radio" name="paytype" value="usd">
<font size="1">USD</font></font></td>
</tr>
<tr valign="top">
<td colspan="2">
<div align="center"><font size="4"> </font></div>
</td>
</tr>
<tr valign="top">
<td colspan="2">
<div align="center">
<input type="hidden" name="tp" value="newptc">
<input type="hidden" name="act" value="addvisit">
<input type="submit" name="Submit" value="Add campaign">
</div>
</td>
</tr>
</table>
<div align="center"></div>
</form>
<br>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#006666"><b><font color="#FFFFFF" face="Arial, Helvetica, sans-serif">ACTIVE
PTC-CAMPAIGNS</font></b></td>
</tr>
<tr>
<td>
<table width=100% border=1 bordercolor=cccccc cellspacing=0>
<tr>
<td>
<div align="center"><i>#</i></div>
</td>
<td>
<div align="center"><i>Code</i></div>
</td>
<td>
<div align="center"><i>Campaign size</i></div>
</td>
<td>
<div align="center"><i>URL</i></div>
</td>
<td>
<div align="center"><i>Delivered visits</i></div>
</td>
<td>
<div align="center"><i>Login</i></div>
</td>
<td>
<div align="center"><i>Password</i></div>
</td>
<td><i>Price</i></td>
<td>
<div align="center"><i>View</i></div>
</td>
</tr>
<?
$sql=mysql_query("SELECT * FROM tasks ORDER BY fn");
$rows=mysql_num_rows($sql);
for($i=0;$i<$rows;$i++)
{
mysql_data_seek($sql,$i);
$arr=mysql_fetch_array($sql);
extract($arr);
echo"
<tr><td>$fn</td><td>$fcode</td><td>$fsize</td><td>$furl</td><td>$fvisits</td><td>$flog</td><td>$fpass</td><td>$prise $fpaytype</td><td><a href=viewvisitcamp.php?fn=$fn target=blank>view</a></td></tr>
";
}
?>
</table>
</td>
</tr>
</table>
Merci de votre aide.