Jump to content

david4ie

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

david4ie's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Works Thanks for the help
  2. Hello I am creating a script which allows users to buy advertising space on my website. The script allows users to buy a certain ammount of clicks. The below script selects a random banner from the DB if the banner has clicks left. the Clicks table is the ammount of clicks bought ... eg 100, 500, 100 the Hits table is how many times the banner has been clicked so far. This is display.php : <?php $mysql_db = "ads"; $mysql_u = "root"; $mysql_p = "" ; MYSQL_CONNECT("localhost","$mysql_u","$mysql_p"); mysql_select_db("$mysql_db"); $result = mysql_query("SELECT * FROM ads"); $num_rows = mysql_num_rows($result); $rand = rand(1,$num_rows); $query1 = "SELECT image_url FROM ads WHERE id = \"$rand\" AND WHERE hits < clicks"; $result1 = mysql_query($query1); while ($row = mysql_fetch_row($result1)) { $image = $row['0']; echo "<a href=\"clicks.php?id=$rand\"><img src=\"$image\" border=\"0\" /></a>"; } ?> The above script gives this error : Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in C:\wamp\www\display.php on line 19 But when I take away AND WHERE hits < clicks the script works fine. Im sure im missing something simple here but I cant seem to find it. Does anybody know the problem? Thanks
  3. Hello I have a car ads site and i have made a dealer sign up form, i want to submit my data to a mysql table. I have written a script but i cant seem to get it to work i keep getting this error [b]Parse error: syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in /home/irishmot/public_html/reg2.php on line 56[/b] Here is the script. [code]<tbody><tr>   <td class="middle_head" align="center">&nbsp;</td> </tr> <tr>   <td valign="top"> <div style="border: 1px solid rgb(204, 204, 204); padding: 5px; margin-top: 5px;">     <form method="post" enctype="multipart/form-data">     <table cellpadding="5" cellspacing="5">       <tbody>       <tr>         <td width="121" class="caption">Login<font color="red">*</font></td>         <td width="221"><input name="login" value="" style="border: 1px solid navy;" type="text"></td>       </tr>       <tr>         <td class="caption">Password<font color="red">*</font></td>         <td><input name="password[original]" style="border: 1px solid navy;" type="password"></td>       </tr>       <tr>         <td class="caption">Password Confirm<font color="red">*</font></td>         <td><input name="password[confirm]" style="border: 1px solid navy;" type="password"></td>       </tr>       <tr>         <td class="caption">E-mail<font color="red">*</font></td>         <td><input name="e-mail" value="" style="border: 1px solid navy;" type="text"></td>       </tr>       <tr>         <td class="caption"><input name="priceplan" type="hidden" id="priceplan" value="Dealer"></td>         <td>&nbsp;</td>       </tr>       <tr>         <td class="caption">Contact info</td>         <td><input name="11" value="" style="border: 1px solid navy;" type="text"></td>       </tr>       <tr>         <td class="caption">Dealer name<font color="red">*</font></td>         <td><input name="12" value="" style="border: 1px solid navy;" type="text"></td>       </tr>       <tr>         <td class="caption"><input name="13" type="hidden" id="13"></td>         <td>&nbsp;</td>       </tr>       <tr>         <td class="caption">Dealer logo</td>         <td><input name="14" value="" style="border: 1px solid navy;" type="file"></td>       </tr>       <tr>         <td colspan="2" align="right"><input value="Register" class="button" type="submit"></td>       </tr>       </tbody>     </table>     </form>   </div></td> </tr> </tbody> <?php $12 = $_POST['12']; $13 = $_POST['13']; $pass1 = $_POST['password[original]']; $user = $_POST['login']; $11 = $_POST['11']; $pass2 = $_POST['password[confirm]']; $email = $_POST['e-mail']; $14 = $_POST['14']; $priceplan = $_POST['priceplan']; $username="user"; $password="pass"; $database="db"; $conn = @mysql_connect(localhost,$username,$password); $rs = @mysql_select_db($database, $conn) or die( "Unable to select database"); $id = rand (11111, 99999) $activation_key = rand (11111, 99999); $current_date = date("Y-m-d"); $sql = "INSERT INTO `users`(`activation_key`, `reg_date`, `11`, `12`,`13`, `14`, `login`, `password`, `e-mail`, `priceplan`, `id`, ) VALUES('".$activation_key."', ".$current_date."', '"$11"', '"$12"', '"$13"', '"$14"', '"$user"', '"$pass1"', '"$email"', '"$priceplan"', '"$id"')"; $rs = mysql_query( $sql, $conn ); if ($rs) { $res .= 'Registration succeeded. Thank you'; } $res = '<div style="border:1px solid #cccccc;margin-top:5;padding:5">'.$res.'</div>'; echo ($res); ?> [/code] Thank you,
  4. Hi :) Does any body no how to send logged user details to a mysql table? thanks [size=1pt][color=purple][i]edited by CV to remove an ad link. [/i][/color][/size]
×
×
  • 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.