wildteen88
Staff Alumni-
Posts
10,480 -
Joined
-
Last visited
Never
Everything posted by wildteen88
-
[SOLVED] trying to write errors to a log file instead of the browser
wildteen88 replied to mottwsc's topic in PHP Coding Help
Use trigger_error instead. -
Should be if(isset($_GET['name'], $_GET['city'], $_GET['country'], $_GET['score'], $_GET['date'])) What is the format of your date? When setting the data type to date for your date column MySQL is expecting the following format yyyy-mm-dd. Or if its datetime then the expected format is yyyy-mm-dd hh:mm:ss
-
I have gone through the code and adjusted it so it works. [attachment deleted by admin]
-
Add the following two lines at the top of all your scripts (except db.php) after the <?php tag error_reporting(E_ALL); ini_set('display_errors', 'on'); Errors should display if there are any problems. Post the errors you get here.
-
Looking at the first code block. You should change all instances of $act to $_GET['act'] For the third block the the variables $id and $category need to be $_GET['id'] and $_GET['category'] Sorry to rant but you can hardly call that a tutorial. All it teaches you is how to copy 'n paste, not how to code. Did you understand the code? If the author of the tutorial doesn't take the time to explain the code then I wouldn't read it. The code is poorly put together and insecure. I'm not surprised it doesn't work. Sorry to rant.
-
[SOLVED] One 'for' loop to simplify multiple nested foreach loops
wildteen88 replied to JsusSalv's topic in PHP Coding Help
What is the out of echo '<pre>' . print_r($containers , true) . '</pre>'; echo '<pre>' . print_r($subcontainers , true) . '</pre>'; Looking at your code you do not need 4 nested foreach loops at all. Only two should do it -
I'd keep it as you have it now while (list(, $temp) = @each($styles)) { if ($user['skinstyle'] == $temp) echo "\t\t\t\t\t\t\t\t".'<option value="'.$temp.'" selected="selected">'.str_replace('_', ' ', $temp).'</option>'."\n"; else echo "\t\t\t\t\t\t\t\t".'<option value="'.$temp.'">'.str_replace('_', ' ', $temp).'</option>'."\n"; } That is much more easer to read/maintain than this. This is why loops where invented ($Profile['skinstyle']=='0')? $i = "selected":""; ($Profile['skinstyle']=='1')? $i1 = "selected":"";($Profile['skinstyle']=='2')? $i2 = "selected":""; ($Profile['skinstyle']=='3')? $i3 = "selected":"";($Profile['skinstyle']=='4')? $i4 = "selected":"";($Profile['skinstyle']=='5')? $i5 = "selected":"";($Profile['skinstyle']=='6')? $i6 = "selected":""; ($Profile['skinstyle']=='7')? $i7 = "selected":"";
-
[SOLVED] Name with Apostrophe in Query String
wildteen88 replied to kjharve's topic in PHP Coding Help
You should use urlencode when setting your url, eg $changeuser = urlencode($changeuser); echo "<a href='admin.php?changeuser=$changeuser&criteria=admin'>Change</a>"; Now when you use $_GET['changeuser'] use urldecode, eg $changeuser = urldecode($_GET['changeuser']); -
This is now more of a HTML/CSS issue than PHP. Please open a new topic in the HTML or CSS forums for help with your layout.
-
[SOLVED] Create Loop and Split string into x variables
wildteen88 replied to grunshaw's topic in PHP Coding Help
<?php $row['steps'] = 'Step 1 - Go here, then turn left|*|Step 2 - Then go straight, turn right at next road|*|Step 3 - Your now there'; $route_steps = explode('|*|', $row['steps']); echo "Steps to take: <ul>\n"; foreach($route_steps as $steps) { list($step_num, $steps) = explode(' - ', $steps); $sub_steps = explode(', ', $steps); echo ' <li>' . $step_num . ' <ul> <li>' . implode("</li>\n <li>", $sub_steps) . '</li> </ul> </li>'."\n"; } echo '</ul>'; ?> As you have less than 10 posts you are required to full in the Captcha. Once you have reached 10 posts or more it will not display. -
By the image I assume you mean the big blue box? Your code is only resizing the <div></div> tag not the <img /> tag.
-
When running your script you need to be going to the following url mywebsite.com/submit_score.php?name=some_name_here&score=some_score_here In order for a record to be inserted into the database. Change this in your VB script MsgBox "Error submitting score!", vbExclamation To MsgBox "Error submitting score! " & vbNewLine & "Response Text = strResponse" & strResponse, vbExclamation What does your VB script output now?
-
Your script is ending prematurely. Looking at your code these lines are the problem. Remove the following if (!isset($_GET['button'])) { header("location:advsearch.php"); exit; }
-
Could you post a live link? so we can test the code.
-
Post the code you're using and the post the contents of your text file here.
-
No you should burn the actual iso file to the disk. You need to use software which is capable of writing bootable disk images. This article explains how to write iso to disk http://www.petri.co.il/how_to_write_iso_files_to_cd.htm
-
You should do this if($nickname != '') { echo "<div class='smallfont'><strong>Nickname : </strong><br />"; echo "$nickname"; echo "</div>"; } <? //query the database $query="SELECT * from tbl_staff where id_movie='$id' order by id_staff"; $result = mysql_query($query) or die ('Failed to execute ' . $query . ' due to ' . mysql_error()); if(mysql_num_rows($result ) > 0) { echo <h3>The Staffs</h3> while ($row = mysql_fetch_array($result)) { $id=$row['id_movie']; $idstaff=$row['id_staff']; $position=$row['position']; $names=$row['names']; echo "<p><div class=\"smallfont\"><strong>".$position."</strong></div>"; echo "<div class=\"smallfont\">".$names."</div></p>"; } }
-
[SOLVED] Create Loop and Split string into x variables
wildteen88 replied to grunshaw's topic in PHP Coding Help
You should seperate your steps with a different character, such as |*| Your steps will be like so tep 1 - Go here, then turn left|*|Step 2 - Then go straight|*|Step 3 - Your now there This allow you to split your steps in to an array easily $steps = explode('|*|', $row['steps']); echo 'Steps to take: <ul>'; foreach($steps as $step) { echo '<li>' . $step . '</li>'; } echo '</ul>'; -
Oosp sorry I made a few mistakes. This if (!isset(_GET['button']) should be if (!isset(_GET['button'])) This <div id="wb_Shape2" style="position:absolute;top:200px;left:54px;width:793px;z-index:10;<?php echo $div_height: ?>" align="center"> should be <div id="wb_Shape2" style="position:absolute;top:200px;left:54px;width:793px;z-index:10;<?php echo $div_height; ?>" align="center">
-
You will be better of using the Facebook Connect API
-
I've never used VB but I can tell what you're mistakes are. Your VB script is calling the following url http://www.mywebsite.com/submit_score.php?name=some_name_here&score=some_score_here Now in submit_score.php you are not retrieving the variables set with in the url.To retrieve name and score url variables you'll need to use the $_GET superglobal, like so $_GET['name'] and $_GET['score']. You'll want to use these variables within your query. Like so if(isset($_GET['name'], $_GET['score'])) { $name = mysql_real_escape_string($_GET['name']); $score = (int) $_GET['score']; $result = mysql_query ("INSERT INTO scores (Name,Score) VALUES ('$name','$score')"); } Now your script will insert the values your VB script pass to score_submit.php However there is one more isse The VB script is expecting some respone from the script. It is expecting the string score submitted! to be returned. To do this change $result = mysql_query ("INSERT INTO scores (Name,Score) VALUES ('$name','$score')"); to $result = mysql_query ("INSERT INTO scores (Name,Score) VALUES ('$name','$score')"); if($result) echo 'score submitted!';
-
This is how you should of done it <?php if (!isset(_GET['button']) { header("location:advsearch.php"); exit; } $error_msg = ''; $search = $_GET['search']; if(strlen($search) < 3) { $error_msg = "Your search must be at least 3 characters long."; $div_height = 'height:500px;'; } else { $div_height = 'height:1200px'; } ?> <div id="wb_Shape2" style="position:absolute;top:200px;left:54px;width:793px;z-index:10;<?php echo $div_height: ?>" align="center"> <?php echo $error_msg; ?> <img src="/Images/body_img.jpg" id="Shape2" align="top" alt="" title="" border="0" width="793"> </div>
-
You will also need to configure Apache with PHP too. You need to add something like the following to Apaches config file (httpd.conf) LoadModule php5_module "/full/path/to/php/php5apache2_2.so" AddType application/x-httpd-php .php However you are better of using YUM to install Apache, PHP. It will take care of everything for you.
-
Unless you don't use HTML5/CSS3 then theres no point in keeping FF2.
-
Nothing much can be simplified, only this code block switch ($type) { case 'I': echo '<img src="http://www.u-stack.com/Image.jpg">'; break; case 'M': echo '<img src="http://www.u-stack.com/Music.jpg">'; break; case 'F': echo '<img src="http://www.u-stack.com/File.jpg">'; break; case 'V': echo '<img src="http://www.u-stack.com/Video.jpg">'; break; case 'J': echo '<img src="http://www.u-stack.com/Job.jpg">'; break; case 'D': echo '<img src="http://www.u-stack.com/Discussion.jpg">'; break; case 'P': echo '<img src="http://www.u-stack.com/Product.jpg">'; break; } in to $types = array( 'I' => 'Image.jpg', 'M' => 'Music.jpg', 'F' => 'File.jpg', 'V' => 'Video.jpg', 'J' => 'Job.jpg', 'D' => 'Discussion.jpg', 'P' => 'Product.jpg' ); if(in_array($type, $types)) { echo '<img src="http://www.u-stack.com/'.$types[$type].'">'; }