jakebur01
Members-
Posts
885 -
Joined
-
Last visited
Everything posted by jakebur01
-
here is the original code that was working before the server change. I can't figure out what's wrong here. function insert_order($order_details) { // extract order_details out as variables extract($order_details); // set shipping address same as address if(!$ship_name&&!$ship_address&&!$ship_city&&!$ship_state&&!$ship_zip&&!$ship_country) { $ship_name = $name; $ship_address = $address; $ship_city = $city; $ship_state = $state; $ship_zip = $zip; $ship_country = $country; } $conn = db_connect(); // insert customer address $query = "select customerid from customers where name = '$name' and address = '$address' and city = '$city' and state = '$state' and zip = '$zip' and country = '$country'"; $result = $conn->query($query); if($result->num_rows>0) { $customer = $result->fetch_object(); $customerid = $customer->customerid; } else { $query = "insert into customers values ('', '$name','$address','$city','$state','$zip','$country')"; $result = $conn->query($query); if (!$result) return false; } $customerid = $conn->insert_id; $date = date('Y-m-d'); $query = "insert into orders values ('', $customerid, ".$_SESSION['total_price'].", '$date', 'PARTIAL', '$ship_name', '$ship_address','$ship_city','$ship_state','$ship_zip', '$ship_country', '0', '0', '0', '0', '0', '0', '0','0','0','0','0','0','0','0')"; $result = $conn->query($query); if (!$result) return false; $query = "select orderid from orders where customerid = $customerid and amount > ".$_SESSION['total_price']."-.001 and amount < ".$_SESSION['total_price']."+.001 and date = '$date' and order_status = 'PARTIAL' and ship_name = '$ship_name' and ship_address = '$ship_address' and ship_city = '$ship_city' and ship_state = '$ship_state' and ship_zip = '$ship_zip' and ship_country = '$ship_country'"; $result = $conn->query($query); if($result->num_rows>0) { $order = $result->fetch_object(); $orderid = $order->orderid; } else return false;
-
this is the line i am getting the error on: $query = "insert into customers values ('', $name', '$address', '$city', '$state', '$zip','$country')"; $result = $conn->query($query)or die(mysqli_error($conn));
-
I am getting the following error: PHP Warning: mysqli_error() expects exactly 1 parameter, 0 given in the error is line 97, which is $query = "insert into customers(name,address,city,state,zip,country) just updated to 5.2.5, everything was working perfectly before. function insert_order($order_details) { // extract order_details out as variables extract($order_details); // set shipping address same as address if(!$ship_name&&!$ship_address&&!$ship_city&&!$ship_state&&!$ship_zip&&!$ship_country) { $ship_name = $name; $ship_address = $address; $ship_city = $city; $ship_state = $state; $ship_zip = $zip; $ship_country = $country; } $conn = db_connect(); // insert customer address $query = "select customerid from customers where name = '$name' and address = '$address' and city = '$city' and state = '$state' and zip = '$zip' and country = '$country'"; $result = $conn->query($query)or die(mysqli_error()); if($result->num_rows>0) { $customer = $result->fetch_object(); $customerid = $customer->customerid; } else { $query = "insert into customers(name,address,city,state,zip,country) values($name','$address','$city','$state','$zip','$country')"; $result = $conn->query($query)or die(mysqli_error()); if (!$result) return false; } $customerid = $conn->insert_id; $date = date('Y-m-d'); $query = "insert into orders values ('', $customerid, ".$_SESSION['total_price'].", '$date', 'PARTIAL', '$ship_name', '$ship_address','$ship_city','$ship_state','$ship_zip', '$ship_country', '0', '0', '0', '0', '0', '0', '0','0','0','0','0','0','0','0')"; $result = $conn->query($query)or die(mysqli_error()); if (!$result) return false; $query = "select orderid from orders where customerid = $customerid and amount > ".$_SESSION['total_price']."-.001 and amount < ".$_SESSION['total_price']."+.001 and date = '$date' and order_status = 'PARTIAL' and ship_name = '$ship_name' and ship_address = '$ship_address' and ship_city = '$ship_city' and ship_state = '$ship_state' and ship_zip = '$ship_zip' and ship_country = '$ship_country'"; $result = $conn->query($query); if($result->num_rows>0) { $order = $result->fetch_object(); $orderid = $order->orderid; } else return false;
-
mysqli_fetch_array() expects parameter 1 to be mysqli_result
jakebur01 replied to jakebur01's topic in PHP Coding Help
that worked but I really need to be able to select a range of specific rows. Is their another way to code it? -
wow! that worked great. Thank you! <meta name="keywords" content="105698,COMBO,120GPEA041,91VG,045,RETAIL,PKG,COMBO,COMBO">
-
now it looks like this: <meta name="keywords" content="HU-108C CARBURETOR,RK21HU KIT TILLOTSON CARBURETOR">
-
I have the variable $title which information from four columns together: <?php $new_title=str_replace(' ',',',$title) ?> <meta name="keywords" content="<?php echo $new_title; ?>"> My problem is that I am winding up with too many commas in between phrases. It is inserting a comma in between every space, I just want one comma in between words. <meta name="keywords" content="HU-108C,CARBURETOR,,,,,,,RK21HU,KIT,TILLOTSON,CARBURETOR">
-
the guy whos server i use set me up a mysql account and database. I use phpmyadmin usually to view things. root with no pass does not work.
-
sorry, I meant *data not going in. I fixed the script, I should have looked at it more closely before posting here so quickly. I found that on the internet and was really paying attention when manipulating it. but now, i get this error: Access denied for user 'jakebur01'@'localhost' (using password: YES) how do I view my mysql permissions?
-
ok, now I'm not getting the error anymore but the data is not going on. I still have something screwed up in the script.
-
I am getting this error. PHP Fatal error: Call to undefined function load_file_data() in C:\Inetpub\mysite\ssc_dataupload.php on line 34 here is the code: $source_file_01 = "C://Inetpub/mysite/text/test.txt"; $destination_table_01 = "item"; //call to function $luinfo = load_file_data($source_file_01, $destination_table_01); // load data infile // EMPTY TABLE BEFORE load function load_file_data($source_file, $destable){ // Connect to the DB $db_host = "localhost"; $db_user = "aaaa"; $db_pass = "aaaa"; $db_name = "aaaa"; $connect = @mysql_connect($db_host,$db_user,$db_pass); @mysql_select_db($db_name); // Empty table $query = "DELETE FROM $db_name.$destable"; $result = mysql_query($query); // do the data import $query = "load data infile \"$source_file\" INTO TABLE $destable FIELDS TERMINATED BY '@'"; $result = mysql_db_query($db_name, $query, $connect) or die("Couldn't execute query"); }
-
[SOLVED] inserting @ delimited file into mysql
jakebur01 replied to jakebur01's topic in PHP Coding Help
thank you. -
Hello, I wrote a script in vb.net that has connected with mssql database and is writing all of the products in the table to a delimited text file. The table had some weird characters in it, so I have it delimited by "@", rather than comma or tab. I would like to use php to insert all of the @ delimited data into mysql database. Thanks, Jake
-
I am getting this error: PHP Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result @ $db = mysqli_connect('localhost', '0', '0', '0'); if (mysqli_connect_errno()) { echo 'Error: Could not connect to database. Please try again later.'; exit; } $result=mysqli_query($db, "select catname ". "from itemclass ". "where catid = $catid"); while ($myrow=mysqli_fetch_array($result)) { echo$myrow["catname"]; }
-
Hello, I have some price files that our vendor provides me with that is in comma delimited format. I generally have to spend a lot of time editing this file in excell in order to get in the right format to be uploaded into our inventory program(as a tab delimited text file). I use php a lot with mysql. Would it be ideal for me to use php to edit these csv files and spit them out as tab delimited files. I am wanting to build a program with php that would edit this file automatically and save it as a tab delimited file. (The manipulation that I do to the csv files involves concatinating "TB" in front of some part numbers and calculating some costs and price quanity breaks. How should I go about doing this. Would you use mysql to edit the data. Also, can php save files across a network? Thanks, Jake
-
can this not be done with php?
-
bump.
-
I have a table on a mssql database that I am constantly having to manually migrate over to a mysql database. I am wanting to create a script that will sycronize "so to speak" from the mssql database table to the mysql database table. Any ideas on getting started with this? Is this possible?
-
Yes, this is the latest. Thanks. I will try phpjunkyard.com.
-
I installed this hesk ticket submission deal for a website. I am having trouble with the session and was hoping someone could help me figure it out. It is telling me: Your session has expired, please login using the form below. Here is the code: define('IN_SCRIPT',1); /* Get all the required files and functions */ require_once('hesk_settings.inc.php'); require_once('language/'.$hesk_settings['language'].'.inc.php'); require_once('inc/common.inc.php'); hesk_session_start(); require_once('inc/database.inc.php'); hesk_dbConnect() or hesk_error("$hesklang[cant_connect_db] $hesklang[contact_webmsater] $hesk_settings[webmaster_mail]!"); /* What should we do? */ $action=hesk_input($_REQUEST['a']) or $action='login'; if ($action == 'login') {print_login();} elseif ($action == 'do_login') {do_login();} elseif ($action == 'logout') {logout();} else {hesk_error($hesklang['invalid_action']);} /* Print footer */ require_once('inc/footer.inc.php'); exit(); /*** START FUNCTIONS ***/ function do_login() { global $hesklang; $user=hesk_isNumber($_POST['user'],$hesklang['select_username']); $pass=hesk_input($_POST['pass'],$hesklang['enter_pass']); $sql = "SELECT * FROM `hesk_users` WHERE `id`=$user LIMIT 1"; $result = hesk_dbQuery($sql) or hesk_error("$hesklang[cant_sql]: $sql</p><p>$hesklang[mysql_said]:<br>".mysql_error()."</p><p>$hesklang[contact_webmsater] $hesk_settings[webmaster_mail]"); $res=hesk_dbFetchAssoc($result); foreach ($res as $k=>$v) { $_SESSION[$k]=$v; } /* Check password */ if ($pass != $_SESSION['pass']) { hesk_session_stop(); hesk_error($hesklang['wrong_pass']); } /* Regenerate session ID (security) */ hesk_session_regenerate_id(); /* Get allowed categories */ if (empty($_SESSION['isadmin'])) { $cat=substr($_SESSION['categories'], 0, -1); $_SESSION['categories']=explode(",",$cat); } session_write_close(); if ($url=hesk_input($_REQUEST['goto'])) { $url = str_replace('&','&',$url); Header('Location: '.$url); } else { Header('Location: admin_main.php'); } exit(); } // End do_login() function print_login() { global $hesk_settings, $hesklang; require_once('inc/header.inc.php'); ?> <p class="smaller"><a href="<?php echo $hesk_settings['site_url']; ?>" class="smaller"><?php echo $hesk_settings['site_title']; ?></a> > <?php echo $hesklang['admin_login']; ?><br> </p> </td> </tr> <tr> <td> <p> </p> <h3 align="center"><?php echo $hesklang['login']; ?></h3> <?php if ($_REQUEST['notice']) { echo '<p align="center" class="important">'.$hesklang['session_expired'].'</p>'; } ?> <form action="admin.php" method="POST"> <div align="center"> <center> <table border="0" cellspacing="1" cellpadding="5"> <tr> <td align="right"><?php echo $hesklang['user']; ?>: </td> <td><select name="user"> <?php $sql = "SELECT * FROM `hesk_users`"; $result = hesk_dbQuery($sql) or hesk_error("$hesklang[cant_sql]: $sql</p><p>$hesklang[mysql_said]:<br>".mysql_error()."</p><p>$hesklang[contact_webmsater] $hesk_settings[webmaster_mail]"); while ($row=hesk_dbFetchAssoc($result)) { echo '<option value="'.$row['id'].'">'.$row['user'].'</option>'; } ?> </select></td> </tr> <tr> <td align="right"><?php echo $hesklang['pass']; ?>: </td> <td><input type="password" name="pass"></td> </tr> </table> </center> </div> <p align="center"><input type="hidden" name="a" value="do_login"> <?php if ($url=hesk_input($_REQUEST['goto'])) { echo '<input type="hidden" name="goto" value="'.$url.'">'; } ?> <input type="submit" value="<?php echo $hesklang['login']; ?>" class="button"></p> </form> <?php } // End print_login() function logout() { global $hesk_settings, $hesklang; require_once('inc/header.inc.php'); hesk_session_stop(); ?> <p class="smaller"><a href="<?php echo $hesk_settings['site_url']; ?>" class="smaller"><?php echo $hesk_settings['site_title']; ?></a> > <?php echo $hesklang['logged_out']; ?><br> </p> </td> </tr> <tr> <td> <p> </p> <h3 align="center"><?php echo $hesklang['logout']; ?></h3> <p> </p> <p align="center"><?php echo $hesklang['logout_success']; ?></p> <p> </p> <p align="center"><a href="admin.php"><?php echo $hesklang['click_login']; ?></a></p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <?php require_once('inc/footer.inc.php'); exit(); } // End logout() I can't figure out what's wrong. I know that my sessions are working ok. I created a session on a test page and then I displayed that session on a second test page.
-
Yes, that worked great! Thank you pocobueno.
-
it's doing it ,but it's looping through the whole database and selecting & displaying sets of 10 over and over
-
I tried that but it is selecting and displaying 10 different random rows. I am wanting a randow selection ,but 10 rows together. EX. 40 7 : 15 40 7 : 16 40 7 : 17 40 7 : 18 40 7 : 19 40 7 : 20 40 7 : 21 40 7 : 22 40 7 : 23 40 7 : 24
-
I have this script that displays verses out of the bible. The problem is that it is only displaying one verse. I would like for it to display about 10 verses in a row. Random selections though. $result = mysql_query("SELECT * FROM bible ORDER BY RAND() LIMIT 1 "); // WHERE catid <> 'TBP' while($myrow = mysql_fetch_array($result)) { $title = $myrow['book'].' '.$myrow['chapter'].' : '.$myrow['verse'].'<br /> '.$myrow['text']; echo $title; echo "<br />"; echo "<br />"; }