Jump to content

[SOLVED] sprintf wont work for me


Cianz

Recommended Posts

I need some help, I cant see the problem -- this wont work:

 

	$query = sprintf("INSERT INTO trades SET anchr=%s, url=%s, domain=%s, username=%s, password=%s, status='pending'", anti_inject($_POST['anchr']), anti_inject($_POST['url']), anti_inject($_POST['domain']), anti_inject($_POST['username']), anti_inject($_POST['password'])); 
mysql_query($query) or die(sql_failure_handler($query, mysql_error()));

 

But this will work:

 

	$retusername = anti_inject($_POST['username']);
$password = anti_inject($_POST['password']);
$retanchr = anti_inject($_POST['anchr']);
$returl = anti_inject($_POST['url']);
$retdomain = anti_inject($_POST['domain']);

$query = "INSERT INTO trades SET username='$retusername', password='$retpassword', anchr='$retanchr', url='$returl', domain='$retdomain', status='pending'";
$queryin = mysql_query($query) or die(sql_failure_handler($query, mysql_error()));

Link to comment
https://forums.phpfreaks.com/topic/109215-solved-sprintf-wont-work-for-me/
Share on other sites

try

<?php
$query = sprintf("INSERT INTO trades SET anchr='%s', url='%s', domain='%s', username='%s', password='%s', status='pending'", anti_inject($_POST['anchr']), anti_inject($_POST['url']), anti_inject($_POST['domain']), anti_inject($_POST['username']), anti_inject($_POST['password'])); 
mysql_query($query) or die(sql_failure_handler($query, mysql_error()));
?>

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.