jcbones
Staff Alumni-
Posts
2,653 -
Joined
-
Last visited
-
Days Won
8
Everything posted by jcbones
-
OK, what is line 100. This forum messes up the tabs as multi-lines.
-
Wow Denno, your editor placed some font's in there. Replace the query: $result = mysql_query("SELECT * FROM productfeed"); With: $result = mysql_query("SELECT * FROM productfeed LIMIT 100"); //you wanted 100 rows right?
-
Show us your query.
-
This countdown includes hours and seconds, incorporates PHP and Javascript. It may not be exactly as you want it, but it shows how you can hold the count between page refreshes. <?php session_start(); $timestamp = time(); $diff = 30; //<-Time of countdown in seconds. ie. 3600 = 1 hr. or 86400 = 1 day. //MODIFICATION BELOW THIS LINE IS NOT REQUIRED. $hld_diff = $diff; if(isset($_SESSION['ts'])) { $slice = ($timestamp - $_SESSION['ts']); $diff = $diff - $slice; } if(!isset($_SESSION['ts']) || $diff > $hld_diff || $diff < 0) { $diff = $hld_diff; $_SESSION['ts'] = $timestamp; } //Below is demonstration of output. Seconds could be passed to Javascript. $diff; //$diff holds seconds less than 3600 (1 hour); $hours = floor($diff / 3600) . ' : '; $diff = $diff % 3600; $minutes = floor($diff / 60) . ' : '; $diff = $diff % 60; $seconds = $diff; ?> <div id="strclock">Clock Here!</div> <script type="text/javascript"> var hour = <?php echo floor($hours); ?>; var min = <?php echo floor($minutes); ?>; var sec = <?php echo floor($seconds); ?> function countdown() { if(sec <= 0 && min > 0) { sec = 59; min -= 1; } else if(min <= 0 && sec <= 0) { min = 0; sec = 0; } else { sec -= 1; } if(min <= 0 && hour > 0) { min = 59; hour -= 1; } var pat = /^[0-9]{1}$/; sec = (pat.test(sec) == true) ? '0'+sec : sec; min = (pat.test(min) == true) ? '0'+min : min; hour = (pat.test(hour) == true) ? '0'+hour : hour; document.getElementById('strclock').innerHTML = hour+":"+min+":"+sec; setTimeout("countdown()",1000); } countdown(); </script>
-
It should work, but there is no better way than testing it.
-
1. there are laws that deal with credit card handling and processing. 2. You MUST have a certificate. To answer your question: https:// The problem: You will have to span a certificate across 2 domains, not sure if that is possible. Otherwise, your data will not be encrypted correctly. Suggestion: All data, processing shouldn't span 2 domains, it should be handled on one. Send the cart to second domain, then process there. Contact the processor to see what they require, and they should help you get it set up. Remember: #1 above.
-
So, maybe instead of "include" you should use "include_once".
-
//try: foreach($array['data'] as $value) { echo 'Name: ' . $value['name'] . '<br />' . "\n"; } Pretty sure that will get you started.
-
Put each of the API's in a separate file. After the form selection is passed, call in which file you need. Make sure you pass the same variables to each script, and receive the same variables back. Everything should go seamlessly.
-
So tell the PHP to only send the form, if the database returns a record. if (mysql_num_rows($result) == 0) { print '<big style="color: red;"><span style="font-weight: bold;"> ERROR MESSAGE:</span></big> Change ID number not found'; echo "<br />"; echo "<br />"; print 'Use the BACK button on your browser to try again'; echo "<br />"; } else { ?> <h3>Change this record</h3> <form action="insert.php" method="post"> AMA #: <input name="ama" type="text" value="<?php echo $ama; ?>"><br> Model Name: <input name="model_name" type="text" value="<?php echo model_name; ?>"><br> Model Mfg: <input name="model_mfg" type="text" value="<?php echo $model_mfg; ?>"><br> Wingspan: <input name="wingspan" type="text" value="<?php echo $wingspan; ?>"><br> Engine Mfg & Size: <input name="engine" type="text" value="<?php echo $engine; ?>"><br> Sound Reading: <input name="decibels" type="text" value="<?php echo $decibels; ?>"> Leave blank if you don't know it.<br> <input value="Send" type="submit"> </form> <?php } ?> </body> </html> Of course I would extract the query from the result resource before I called the values.
-
Yes, ignace, I meant array_filter() sorry. Thinking one thing, typed another.
-
echo implode(',',$id);
-
Pass the array through array values, then to the min function. $arr = array_values($DF); //array values with no second argument, strips out any value that is equivalent to boolean false. This includes integer 0, or string 0. $val = min($arr);
-
How you capture the name, is strictly tied to how you display it. In short, we need to see some code:
-
Yes, it is just showing you how you can change your DB array (1st array) to list as your desired variable array (last array). Take your DB array, and change up the values, and you will notice that the values in the last array change places.
-
Could try something like: <?php $array = array(3,2,1); //array holding your db values. $variables = array(100,50,5); //array holding your var values, this array should be set up so the key is the expected value of your DB array. foreach($array as $k => $v) { if(array_key_exists($k,$variables)) { $var[] = $variables[$k]; } } //This is all just echoing back to the screen. echo '<pre>'; var_dump($array); var_dump($variables); var_dump($var); $array = $var; //re-assign array to var. echo 'Your array now holds:'; var_dump($array); echo '</pre>'; ?>
-
That information would have resulted in a much better answer. Is the array value tied to the variable value in any way?
-
if($subzz[2] == 1) { $var = 100; } elseif( $subzz[1] == 2) { $var = 50; } elseif( $subzz[0] == 2) { $var = 5; }
-
index.php in views/layouts/shop/ doesn't exist. Make sure all of your files and directories are uploaded, and named the same as your local server.
-
An example of doing this with a flatfile: <?php $header = NULL; $body = NULL; $footer = NULL; if(isset($_POST)) { foreach($_POST as $k => $v) { $$k = $v; } } $write = "<?php \$header = '$header'; \$body = '$body'; \$footer = '$footer'; ?>"; file_put_contents('variables.php',$write); echo <<<EOF <form action="" method="post"> <label for="header">Header</label><br /> <input type="text" name="header" value="" /><br /> <br /> <label for="body">Body</label><br /> <textarea cols="40" rows="10" name="body"></textarea><br /><br /> <label for="footer">Footer</label><br /> <input type="text" name="footer" value="" /><br /><br /> <input type="submit" name="submit" value="SUBMIT" /> </form> EOF; if(file_exists('variables.php')) { include('variables.php'); echo '<div>' . $header . '</div><div>' . $body . '</div><div>' . $footer . '</div>'; } ?> Rather crude, but hey it was 2 minutes.
-
How does these new rows solve your picture problem. Your 3 rows selects pictures 1 - 3. Short story is your limit. LIMIT row_start , rows_returned. So it would be: LIMIT 0,6 //start at the first row, and return 6 of them.
-
Yep, I didn't take anything out, but I did add something in Just forgot to declare a variable. add it in: //FIRST ROW SHORTEN PARAGRAPH $i = 0; Sorry.
-
Dreamweaver is notorious for doing this. It is as BlueSky states. You are calling mysql_fetch_assoc which increments your array data pointer by 1, then you follow it up later with another call. This second call doesn't reset the data pointer. So you miss your first row of data. Take out the first data call, as it is not needed or used.
-
I don't think I changed anything. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Example Form</title> <link rel="stylesheet" type="text/css" href="dd.css" /> <script type="text/javascript" src="jquery-1.3.2.min.js"></script> <script type="text/javascript" src="jquery.dd.js"></script> </head> <body> <!-- .style1 { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color: #000000; background-color: #FFFFCC; padding: 2px; height: 14px; width: 200px; border: 1px solid #7F9DB9; } --> <?php error_reporting(E_ALL); ini_set('display_errors', '1'); mysql_connect("localhost", "", "")or die("cannot connect"); mysql_select_db("test")or die("cannot select DB"); $tbl_name="test_mysql"; $sql="SELECT * FROM $tbl_name"; $result=mysql_query($sql); $count=mysql_num_rows($result); ?> <br> <?php //$picture = array(); while($row = mysql_fetch_assoc($result)) { $id = $row['id']; switch ($row['icon']) { case 1: $picture[$id] = '<img src="http://www.nikibone.com/recipe/fruit/graphics/apples.jpg" title="apple" alt="apple" />'; //echo $picture[$id]; break; case 2: $picture[$id] = '<img src="http://www.nikibone.com/recipe/fruit/graphics/bananas.jpg" title="banana" alt="banana" />'; //echo $picture[$id]; break; case 3: $picture[$id] = '<img src="http://www.nikibone.com/recipe/fruit/graphics/oranges.jpg" title="orange" alt="orange" />'; //echo $picture[$id]; break; default: $picture[$id] = ''; echo $row['icon'] . " is something other than 1 2 or 3"; break; } } //FIRST ROW SHORTEN PARAGRAPH $result0 = mysql_query("SELECT * FROM test_mysql LIMIT 0,3")or die(mysql_error()); $row0 = mysql_fetch_array($result0); while($row0 = mysql_fetch_assoc($result0)) { $paragraph0 = $row0['message']; $rough_short_par0 = substr($paragraph0, 0, 100); $clean_short_par0 = substr($rough_short_par0, 0); $clean_sentence_row1 = $clean_short_par0 . "..."; ?> <hr> <?php echo ($i > 0) ? '----' : NULL; echo $row0['monthday'] ."<br>" .$row0['title'] ."<br>" .$row0['message'] ."<br>" .$clean_sentence_row1 ."<br>" .$picture[++$i] ."<br>"; } ?> </body> </html>