Jump to content

cmor

Members
  • Posts

    19
  • Joined

  • Last visited

    Never

Everything posted by cmor

  1. This may be a bit removed from straight php, but I have a submit button for an e-commerce site as the final step. It runs through all of the php steps and submits the order. The problem is....sometimes the submit button doesn't do anything for some users. They hit it and nothing happens. Is there a way I can verify everything is loaded correctly with php? Its hard to nail it down to a specific problem. Has anyone had this issue in the past?
  2. It looked like you were just storing image links..... My previous solution would not work in your case anyhow. Replace this for your loop: while($row=mysql_fetch_array($result)) echo "<b>Skill Icon: </b><img src=\"$row['image']\"><br>"; }
  3. I've tried everything and have yet to make a successful SOAP connection. I usually end up with an Internal Server error, or nothing at all. I've gone through about 10 different wsdl's over the past week. I've tried making my own servers, using others, everything. I've installed the PEAR Soap package on my shared hosting server and referenced Client.php in each instance. Is there anything else that needs to be done to the PHP configuration to enable SOAP connections? There is no reference to soap in my phpinfo() request. Starting to grasp at straws.
  4. $query = "SELECT * FROM $tbl_name"; $result = mysql_query($query); $num = mysql_num_rows($result); while ($i < $num) { $row = $result->fetch_row(); echo "<b>Skill Icon: </b><img src=\"$row['image']\"><br>"; $i++; }
  5. http://articles.sitepoint.com/article/php-gallery-system-minutes/5 Mainly $destination_handle = imagecreatetruecolor( $thumbnail_width, $thumbnail_height ); ImageCopyResampled( $destination_handle, $source_handle, 0, 0, 0, 0, $thumbnail_width, $thumbnail_height, $size[0], $size[1] );
  6. I'm requiring a php SOAP client in some of my pages. It is below the public level of the server. I'm using require_once('../../../php/SOAP/Client.php'); Client.php is a part of about 7 pages that all require each other in their respective code. Within these pages they use an interesting way to require the neighboring page. To require a page on the same directory they drop a level. For example they use require_once(SOAP/Values.php) as opposed to require_once(Values.php) . I haven't seen this before. Even more odd is that when I require the first page (Client.php), this way of allocating works some of the time. It will always work for some pages with the require, and always error on others, giving the common error. Warning: require_once(SOAP/Value.php) [function.require-once]: failed to open stream: No such file or directory in /home/xxxx/php/SOAP/Client.php on line 26 I've verified this is actually occurring in every way possible way. I require the file in some pages and it works, others I would have to remove the extra directory. I have no idea what is going on. Can anyone shed some light?
  7. I don't think $_POST as $key=>$row['number_on_hand]' is what your looking for. It's hard to tell from your block of code but you need to check if the quantity is above 'number_on_hand' something along the lines of if($qty > row['number_on_hand']){ $qty = row['number_on_hand]'); $message = 'Max quantity available in basket'; }else{ updatecart(...) } Hopefully that helps a small amount. You're going to have to query your database for the number_on_hand'... Are you using paypal?
  8. Hopefully a very simple question. Looking to see if ->execute on a prepared SELECT statement returns any results. ->execute simply returns true if it was successful (results or not). It also returns an array with a count of 1 using ->fetch Here's where I'm at: public static function authenticate($user='',$password='') { global $db; $sql = 'Select * FROM users WHERE username = :user AND password = :password LIMIT 1'; $stmt = $db->prepare($sql); $stmt->bindValue(':user',$user); $stmt->bindValue(':password',sha1($password)); $stmt->execute(); $row = $stmt->fetch(PDO::FETCH_ASSOC); return count($row)!=1 ? array_shift($row) : false; } It works but seems awkward.
  9. Thanks for the reply. That does solve the immediate problem. But if magic_quotes is turned off wouldn't I then be entering unfiltered data? Would this not be a better implementation: $firstname = get_magic_quotes_gpc() ? mysqli_real_escape_string($db, trim(stripslashes($_POST['firstname']))) :mysqli_real_escape_string($db, trim( $_POST['firstname']));
  10. I'm trying to input Session variables into a mysql database. Everything inputs fine, but I am trying to make it more secure by filtering values through mysqli_real_escape_string(). However, it appears that most(all?) of the special characters are already escaped in the Session variables. Therefore when I pass it through mysqli_real_escape_string() I get double escaped characters. For example, If the user inputs 's Chris as their first name. I get the following output from the below code: echo $_SESSION['firstname']; echo '<br />'; echo mysqli_real_escape_string($db,$_SESSION['firstname']); Output: \'s Chris \\\'s Chris How do I overcome this problem and still make sure all my entries are secure?
  11. I actually want 168 records.....I guess I spaced on the post title. There is currently a 1000 or so in the database The currentlly produces: nothing Thanks for the response
  12. Why oh why does this not work: @ $db = new mysqli('localhost', user', 'password', 'database'); $query = "select * from weather where timekey in (select * from weather ORDER BY timekey desc LIMIT 168) order by timekey asc"; $result = $db->query($query); I need to select the last records in the database and order them in ascending order. sigh....
  13. I have a basic inserting data question. Here's my code: for($i = 0; $i < $j; $i++){ $query = "INSERT INTO weather VALUES ('$snowdata[$i][0]','$snowdata[$i][1]','$snowdata[$i][2]','$snowdata[$i][3]','$snowdata[$i][4]', '$snowdata[$i][5]','$snowdata[$i][6]','$snowdata[$i][7]','$snowdata[$i][8]','$snowdata[$i][9]','$snowdata[$i][10]','$snowdata[$i][11]','$snowdata[$i][12]', '$snowdata[$i][13]','$snowdata[$i][14]')"; $db->query($query); } First off, it doesn't work because I assume the snowdata matrices aren't being evaluated? Or is there something else obvious I'm missing? Second off, is it some how possible to insert an array (or row of a matrix) directly into a row of an sql database? Thanks for any pointers or leads. -Chris
  14. When I run this snippet: 77 78 @ $db = new mysqli('localhost', 'username', 'password', 'mydatabase'); 80 81 if (mysqli_connect_errno()) 82 { 83 echo 'Error: Could not connect to database. Please try again later.'; 84 exit; 85 } 86 87 LOAD DATA INFILE 'sqlsnow.txt' INTO TABLE weather; 87 $db->close(); I get: Parse error: syntax error, unexpected T_STRING in /home/cmor/public_html/sqlfile.php on line 87 Could anyone point me in the right direction? Thanks, -Chris
  15. Thanks, since every hours will only ever have one entry, I'll use the date.
  16. Although most of you have probably made hundreds I'm about to attempt my first mysql database. I'm attempting to build a database of weather data from the page: http://www.nwac.us/products/OSOCMT It will compile each days weather and save it sequentially. I've already done it in a flat file and am working my way up to a mysql database. Currentlly it looks something like this: 7 11 600 64 57 69 8 13 17 96 7 11 700 67 60 65 7 12 18 103 7 11 800 70 65 53 8 13 18 106 7 11 900 73 70 47 5 11 18 110 7 11 1000 75 76 42 0 7 15 121 7 11 1100 75 80 29 0 5 12 111 7 11 1200 76 84 23 0 3 12 84 7 11 1300 78 87 24 0 3 9 158 7 11 1400 77 87 23 0 2 8 197 7 11 1500 81 86 28 0 2 10 221 7 11 1600 86 83 36 0 3 10 346 7 11 1700 89 81 40 0 4 11 334 7 11 1800 83 77 46 0 5 14 323 7 11 1900 79 70 66 0 5 11 324 7 11 2000 65 67 69 0 4 9 343 7 11 2100 64 63 70 5 8 11 338 7 11 2200 64 62 67 5 7 9 347 7 11 2300 64 61 70 4 7 10 5 Where the first column is the month, next coloumn day, next coloumn hour, and then the data. The book I'm reading says databases search much faster when using the key as the search function. My question is does it make more sense to make the key as a normal 1,2,3,4. Or should I make it something like 7112300,7112400,7112500, etc. corresponding to each hour time frame. When I search through the database I will almost always be searching by time frame and grouping the data into days. So would it be quicker to search through keys that have the inherent date and time in them? Thanks for any help. I don't have the foresight to see what it will be like down the road. -Chris
  17. Thanks, so to confirm there's no way to call a column? You have to switch the array's dimensions around?
  18. Very simple question but I'm having trouble finding an answer by searching the forum. I have a 2-d array. I want to pass columns from the 2-d array to a file that will graph the columns. Let's say its called my2darray I can pass a row with something like my2darray[4] But I can't pass a specific column with my2darray[][4] Any help with the syntax or a link to the solution would be helpful. Do I have to use a loop to call a whole column? Thanks for the help.
×
×
  • 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.