Jump to content

truck7758

Members
  • Posts

    49
  • Joined

  • Last visited

    Never

Everything posted by truck7758

  1. yes i am using php5 and i have also inserted extension=php_mysqli.dll into my php.ini. any ideas? Cheers
  2. Hi, when trying to view my web page im getting the following error: Fatal error: Class 'mysqli' not found in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\neworder.php on line 42 Line 42 is the first line of sql within the page which is $mysqli = new mysqli('localhost','username','password'); Any ideas, Thanks
  3. $rCrime = mysql_query("SELECT id,auto,geld,wapen,chauffeur,wapenexpert FROM ".$oc." WHERE gamename='".$prefix."' AND id = '.intval($_GET['id']).' AND leader = '".$data->login."';"); try that. this is almost the same as a query i have running and that works fine
  4. Parse error: syntax error, unexpected '"' in is that the whole error message?
  5. $rCrime = mysql_query('SELECT id,auto,geld,wapen,chauffeur,wapenexpert FROM ".$oc." WHERE gamename='".$prefix."' AND id = '.intval($_GET['id']).' AND leader = "'.$data->login.'"'); try that
  6. sorted now. dont know how lol heres the code i used for anyone else who may find it useful <?php $host = 'localhost'; $user = 'username'; $pass = 'password'; $db = 'orders'; $table = 'orders'; $file = 'order'; $link = new mysqli(localhost, username, password) or die("Can not connect1." . mysql_error()); mysqli_select_db($link, "orders") or die("Can not connect2."); $result = mysqli_query($link, "SHOW COLUMNS FROM ".$table."", MYSQLI_STORE_RESULT); $i = 0; if (mysqli_num_rows($result) > 0) { while ($row = mysqli_fetch_assoc($result)) { $csv_output .= $row['Field'].", "; $i++; } } $csv_output .= "\n"; $values = mysqli_query($link, "SELECT * FROM ".$table.""); while ($rowr = mysqli_fetch_row($values)) { for ($j=0;$j<$i;$j++) { $csv_output .= $rowr[$j].", "; } $csv_output .= "\n"; } $filename = $file."_".date("Y-m-d_H-i",time()); header("Content-type: application/vnd.ms-excel"); header("Content-disposition: csv" . date("Y-m-d") . ".csv"); header( "Content-disposition: filename=".$filename.".csv"); print $csv_output; exit; ?> Thanks All
  7. iv now managed to get to this <?php $mysqli = new mysqli('localhost','root','newr00t'); $mysqli->select_db('orders'); $query_rsReport = "select * from orders"; $rsReport = $mysqli->query("SELECT * FROM orders"); $totalRows_rsReport = mysqli_num_rows($rsReport); if (mysqli_field_count($rsReport)) { /* this was a select/show or describe query */ $fields = mysqli_store_result($rsReport); //$fields = mysqli_field_count($rsReport); for ($i = 0; $i < $fields; $i++) { $header .= $mysqli->field_name($rsReport, $i) . ","; } while ($row = $mysqli->fetch_row($rsReport)) { $line = ''; foreach ($row as $value) { $value = '"' . $value . '"' . ","; $line .= $value; } $data .= trim($line) . "\n"; } $title = "Will appear in the top left cell"; $data = str_replace("\r", " ", $data); header("Content-type: application/x-msdownload"); header("Content-Disposition: attachment; filename=cdbg_r1.csv"); header("Pragma: no-cache"); header("Expires: 0"); print "$title\n\n$header\n$data"; mysqli_free_result($fields); $rsReport->close; ?> and now im getting the error: Parse error: syntax error, unexpected $end in c:\webs\test\export.php on line 36 which is my last line. Any ideas, Mike
  8. iv now sorted that by making it: $rsReport = $mysqli->query($query_rsReport, $mysqli); now im getting: Fatal error: Call to undefined method mysqli::num_rows() in c:\webs\test\export.php on line 7 line 7 = $totalRows_rsReport = $mysqli->num_rows($rsReport); any ideas, cheers
  9. ok, heres what iv managed to get <?php $mysqli = new mysqli('localhost','username','password'); $mysqli->select_db('orders'); $query_rsReport = "select * from orders"; $rsReport = mysqli->query($query_rsReport, $mysqli); $totalRows_rsReport = mysqli->num_rows($rsReport); $fields = mysqli->field_count($rsReport); for ($i = 0; $i < $fields; $i++) { $header .= mysqli->field_name($rsReport, $i) . ","; } while ($row = mysqli->fetch_row($rsReport)) { $line = ''; foreach ($row as $value) { $value = '"' . $value . '"' . ","; $line .= $value; } $data .= trim($line) . "\n"; } $title = "Will appear in the top left cell"; $data = str_replace("\r", " ", $data); header("Content-type: application/x-msdownload"); header("Content-Disposition: attachment; filename=cdbg_r1.csv"); header("Pragma: no-cache"); header("Expires: 0"); print "$title\n\n$header\n$data"; $rsReport->close; ?> this gives the error message: Parse error: syntax error, unexpected T_OBJECT_OPERATOR in c:\webs\test\export.php on line 6 line 6 = $rsReport = mysqli->query($query_rsReport, $mysqli); any ideas? Thanks
  10. yeh i re-read your post after i replied and realised that how do you go about changing the mysql to mysqli as i may not know much but i know its not just a case of adding the 'i' onto the end of all the mysql's thanks
  11. Hi, Whats $CDBG? also i dont think this will work as only mysqli queries seem to work on mine (have no idea why) cheers
  12. i have created a php site where you can add/view the database but now i want to add a link where you can download the contents of a particular table into an csv file Thanks
  13. its saved locally. to connect i use $mysqli = new mysqli('localhost','username','password');
  14. any ideas, tips, prod in the right direction. I seem to be able to find instructions on how to do it using mysql but for some reason i only seem to be able to use mysqli (excuse my noobiness is this doesn't make sense) Thanks
  15. Hi, would it be possible to add a export function in php so it exports all my sql results to a csv or something similar (just to be able to be viewed in excel). Thanks, Mike
  16. $createQuery1 = "INSERT INTO tblOwnerBK (`title`, `ownerName`,`address`,`phoneNumber`) VALUES ('".$title."','".$ownerName."','".$address."','".$phoneNumber."')"; try that
  17. can anyone see whats wrong with this query: <? $supp = $_POST["supp"]; $supp = addslashes($supp); // Connecting, selecting database $mysqli = new mysqli('host','username','password'); $mysqli->select_db('orders'); // Performing SQL query $result = $mysqli->query("SELECT * FROM supplier where `name` = '".$supp."'"); while($line = $result->fetch_assoc()) { echo "\t<tr>\n"; foreach ($line as $col_value) { if (empty($col_value)) { echo "\t\t<td> </td>\n"; } else { echo "\t\t<td>$col_value</td>\n"; } } echo "\t</tr>\n"; } // Free resultset mysqli_free_result($result); // Closing connection $mysqli->close(); ?> Thanks, Mike
  18. Hi, i have created a page that displays a list of suppliers but what i want to be able to do is filter the results to specify individual suppliers. I currently have the following code which displays the full table: <title>View Suppliers</title> <BODY TEXT="red" LINK="yellow" BGCOLOR="black"> <a href="http://www.google.co.uk"> <img src="new_logo2.jpg" alt="logo" align="center" width="210" height="95" /> </a> <? print strftime("%A %dth %B %Y %H:%M"); ?> <h1 align="center">Suppliers<h1> <table border=\"7\"> <tr> <th>Supplier ID</th> <th>Name</th> <th>Address</th> <th>Telephone Number</th> <th>Fax Number</th> <th>Website</th> <th>Account Number</th> <th>Account Manager</th> <th>Email Address</th> <th>Account Login</th> <th>Account Password</th> <th>Other Info</th> </tr> <?php // Connecting, selecting database $mysqli = new mysqli('host','username','password'); $mysqli->select_db('orders'); // Performing SQL query $result = $mysqli->query("SELECT * FROM supplier"); while($line = $result->fetch_assoc()) { echo "\t<tr>\n"; foreach ($line as $col_value) { if (empty($col_value)) { echo "\t\t<td> </td>\n"; } else { echo "\t\t<td>$col_value</td>\n"; } } echo "\t</tr>\n"; } // Free resultset mysqli_free_result($result); // Closing connection $mysqli->close(); ?> </table> <p> <a href="index.php"> <INPUT TYPE="SUBMIT" VALUE="Home" STYLE="font-family:sans-serif; font-size:large; font-style:italic; background:red; color:black; width:6em; height:1.5em"> </a> and i also have the following which creates the drop down list of suppliers: <? $mysqli = new mysqli('localhost','root','newr00t'); $mysqli->select_db('orders'); $result = $mysqli->query("SELECT * FROM supplier"); echo "<SELECT name='supp'>\n"; while($row = $result->fetch_assoc()) { echo "<option value='{$row['suppid']}'>{$row['name']}</option>\n"; } echo "</select>\n"; $result->close(); ?> what i need now is to join the two with sum sort of 'submit' button but i dont really know how to do this. Any ideas, Thanks
  19. seems fine to me using firefox
  20. resolved using previous suggestion by ansarka. the reason it didnt work straight away was i had an error on my insert script Thanks All
  21. Any ideas??? Thanks, Mike
  22. i have now done a few more tests and it is now just submitting the value '1' and i cannot see where it is getting this value from. Any ideas, Mike
  23. i have just done another test and this timme it submitted '2' ??? Thanks, Mike
  24. This no displays 'Select' as the default value although i have changed this to '0' which is great but now when i submit my form it submits the value '3' ??? Any ideas? Thanks, Mike
×
×
  • 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.