Toon posts:

Query is emty

Pagina: 1
Acties:
  • 35 views sinds 30-01-2008

Verwijderd

Topicstarter
Hello,

Ik heb ondertussen het een en ander geraadpleegd. En ik ben dus tot hier geraakt. Nu krijg ik enkel nog de mededeling dat

"Warning: sprintf(): Too few arguments in /var/www/vhosts/backup/reseler16/fedhoreca.oakfield.be/htdocs/new_site/admin/add_user2.php on line 39
Query was empty"


heeft er misschien iemand een ideetje wat er nog mis loopt?

alvast bedankt

PHP:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
[php=4]
<?php require_once('../Connections/connexion.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
$editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
  $editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}

if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "form1")) {
  $insertSQL = sprintf("INSERT INTO tb_user (nom, login, pwd, email, acces)
                                     VALUES (%s, %s, %s, %s, %s, %s, %s)",
                       GetSQLValueString($HTTP_POST_VARS['nom'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['login'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['pwd'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['email'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['acces'], "int"));
                      

  mysql_select_db($database_connexion, $connexion);
  $Result1 = mysql_query($insertSQL, $connexion) or die(mysql_error());

/*
 header(sprintf("Location: %s", $editFormAction)); 
*/

}

?>

<?php
mysql_select_db($database_connexion, $connexion);
$query_q_user_all = "SELECT * FROM tb_user ORDER BY nom ASC";
$q_user_all = mysql_query($query_q_user_all, $connexion) or die(mysql_error());
//$row_q_user_all = mysql_fetch_assoc($q_user_all);
$totalRows_q_user_all = mysql_num_rows($q_user_all);
define('SELF',$_SERVER['PHP_SELF']);
$content_line = '';
while ($row_q_user_all = mysql_fetch_assoc($q_user_all)){
$content_line .='<form name="form'.$row_q_user_all['id_user'].'" method="post" action="'.SELF.'">';
$content_line .='<tr><td><input name="id_user" type="hidden" value="'.$row_q_user_all['id_user'].'">';
$content_line .='<input type="text" name="nom" value="'.$row_q_user_all['nom'].'"></td>';
$content_line .='<td><input type="text" name="login" value="'.$row_q_user_all['login'].'"></td>';
$content_line .='<td><input type="password" name="pwd" value="'.$row_q_user_all['pwd'].'"></td>';
$content_line .='<td><input type="text" name="email" value="'.$row_q_user_all['email'].'"></td>';
$content_line .='a';
$content_line .='<td><select name="acces">
        <option value="all" '.$row_q_user_all['acces']=='all'?'selected':''.'>All</option>
        <option value="cafe"'.$row_q_user_all['acces']=='cafe'?'selected':''.'>Caf&eacute;</option>
        <option value="hotel"'.$row_q_user_all['acces']=='hotel'?'selected':''.'>H&ocirc;tels</option>
        <option value="resto"'.$row_q_user_all['acces']=='resto'?'selected':''.'>Restaurants</option>
      </select></td>';
$content_line .='<td><input name="mod" type="submit" id="submit" value="Modifier"></td>';
$content_line .='<td><input type="Submit" name="sup" id="submit" value="Supprimer"></td></tr></form>';
};
?>
<?php echo $_POST['id_user']; ?>

  <table width="100%"  border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td>nom</td>
      <td>login</td>
      <td>mot de passe </td>
      <td>email</td>
      <td>acces</td>
      <td>modifier</td>
      <td>supprimer</td>
    </tr>
   <?php echo $content_line; ?>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <form name="form1" method="post" action="<?php echo $editFormAction ?>">
    <tr>
      <td><input name="MM_insert" type="hidden" value="form1">
      <input type="text" name="nom"></td>
      <td><input type="text" name="login"></td>
      <td><input type="text" name="pwd"></td>
      <td><input type="text" name="email"></td>
      <td><select name="acces">
        <option value="5">5</option>
        <option value="4">4</option>
        <option value="3">3</option>
        <option value="2">2</option>
      </select></td>
      <td><input type="submit" name="Submit" value="Ajouter"> </td>
      <td>&nbsp;</td>
    </tr>
    </form>
  </table>


<?php


mysql_free_result($q_user_all);
echo "$q_user_all";


?>
[/php]

[ Voor 28% gewijzigd door Verwijderd op 21-09-2005 16:48 ]


Verwijderd

En welke regel is dat in de bovenstaande code? En heb je al gekeken naar de waardes van variabelen die je aan methodes meegeeft?

Verwijderd

Topicstarter
de 40ste denkik... maar daar zit het em net... denk ik ( ik geef toe ik ben eigenlijk maar een ontwerper die een poging waagt om te developen )

  • zwippie
  • Registratie: Mei 2003
  • Niet online

zwippie

Electrons at work

$insertSQL = sprintf("INSERT INTO tb_user (nom, login, pwd, email, acces)
VALUES (%s, %s, %s, %s, %s, %s, %s)",
Je geeft hier aan dat je 5 velden wilt invullen maar geeft vervolgens 7 keer een %s mee in VALUES, dat lijkt me iig niet te kloppen.

* zwippie doet ook een gok

How much can you compute with the "ultimate laptop" with 1 kg of mass and 1 liter of volume? Answer: not more than 10^51 operations per second on not more than 10^32 bits.


  • whoami
  • Registratie: December 2000
  • Laatst online: 30-04 15:31
Hoi,

Het is niet de bedoeling dat je hier zomaar je code kunt neerplempen met een error-melding, en dan maar verwacht dat wij het voor jou gaan debuggen.
Debuggen is iets wat je zelf moet kunnen: interpreteer de foutmelding, zie welke regel misloopt, voer stap voor stap de code uit, google eens op de foutmelding etc...

Owja, lees ook even dit:
*** Over topictitels in P&W - lezen voor topic openen!!! ***
Welkom in P&W: FAQ en Beleid *updated: 20 mei*

[ Voor 19% gewijzigd door whoami op 21-09-2005 16:54 ]

https://fgheysels.github.io/


Dit topic is gesloten.