Jump to content

ckir5951

New Members
  • Posts

    8
  • Joined

  • Last visited

ckir5951's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. The below code produces a dropdown and when a selection is made and submitted produces a table row with a link to the record but the link doesn't work. suggestions? --------------------------------------------------------------------------- <!DOCTYPE><html><head> <title>lookup menu</title> </head> <body><center><b> <form name="form" method="post" action=""> <?php // error_reporting(0); error_reporting(E_ALL ^ E_NOTICE); include 'homedb-connect.php'; //This creates the drop down box echo "<select name= 'target'>"; echo '<option value="">'.'--- Select account ---'.'</option>'; $query = mysqli_query($con,"SELECT target FROM lookuptbl"); $query_display = mysqli_query($con,"SELECT * FROM lookuptbl"); while($row=mysqli_fetch_array($query)) {echo "<option value='". $row['target']."'>".$row['target'] .'</option>';} echo '</select>'; ?> <input type="submit" name="submit" value="Submit"/> </form><center> <?php // error_reporting(0); error_reporting(E_ALL ^ E_NOTICE); include 'homedb-connect.php'; if(isset($_POST['target'])) { $name = $_POST['target']; $fetch="SELECT target, purpose, user, password, email, visits, date, saved FROM lookuptbl WHERE target = '".$name."'"; $result = mysqli_query($con,$fetch); if(!$result) {echo "Error:".(mysqli_error($con));} //display the table echo '<table border="1"><tr><td bgcolor="#ccffff" align="center">lookup menu</td></tr> <tr><td> <table border="1"> <tr> <td> Target </td> <td> Purpose </td> <td> User </td> <td> Password </td> <td> Email </td> <td> Visits </td> <td> Date </td> <td> Saved </td> </tr>'; while($data=mysqli_fetch_row($result)) { $url= "http://localhost/home/crud-link.php?target=". $data[0]; $link= '<a href="'.$url.'">'. $data[0]. '</a>'; echo ("<tr><td> $link </td><td>$data[1]</td><td>$data[2]</td><td>$data[3]</td> <td>$data[4]</td><td>$data[5]</td><td>$data[6]</td><td>$data[7]</td></tr>"); } echo '</table> </td></tr></table>'; } ?> </body></html>
  2. Hi, I could use a little guidance here. 1) is a function with values to be sent to 2). 1) <!-- use ajax - OnCalc function to send data to your database. --> function OnCalc(value1,op,value2,total) { 2) php file using above function values <?php header( "refresh:5;url='http://localhost/home/calcprint.php'"); echo 'You\'ll be redirected in about 5 secs. If not, click <a href="http://localhost/home/calcprint.php">here</a>.'; echo '<script type="text/javascript">' , 'OnCalc();' , '</script>'; No error but code not working?
  3. Hi, I want to chenge the following statement so that numbers ending with ".00" are changed to blank. Many opinions but I haven't got any to work. Any help? <td align=right class="currency">$'.number_format($row['value1'],2).'</td>
  4. Hi, I am having trouble coding for mysqli update. Please, somebody tell me the correct way. I'm trying to update the "lastused" (current date) field in "emailtbl". Somebody please tell the best way to code this. Below is the message and following, the current code: $db = new mysqli('localhost', 'root', 'pass', 'mydb'); if($db->connect_errno > 0) {die('Unable to connect to database [' . $db->connect_error . ']');} $sql = <<<SQL SELECT * FROM `emailtbl` WHERE `id` = '$id' SQL; if(!$result = $db->query($sql)) {die('There was an error running the query [' . $db->error . ']');} $lastused = $_POST['lastused']; $lastused = curdate(); echo "last date accessed is ".$data['lastused']; $result->free(); $db->escape_string('This is an unescape "string"'); $db->close(); ?> $update = mysqli_query($dbconnect, "UPDATE emailtbl SET lastused = curdate() WHERE id ='$id'"); if($update == false) { die("UPDATE FAILED: ".mysqli_error($dbconnect)); } echo "$lastused is the last date this account was accessed";
×
×
  • 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.