jcbones
Staff Alumni-
Posts
2,653 -
Joined
-
Last visited
-
Days Won
8
Everything posted by jcbones
-
Arithmetic Operators for PHP You can keep it all in one file. PHP can mix with HTML. Xamp or WAMPServer, or anything that will parse PHP code is all that is needed. Put it in your htdoc folder, then open up your browser and type 'localhost/file.php'.
-
That is correct. What do you mean by "not working"?
-
Sorry, it is hard to part sarcasm into a post.
-
delimiter being talked about is the semi-colon after your variable. And, you are echo'ing it, but judging from your post, you are wanting to know how to remember it's checked state. 1. A checkbox is either on or off. 2. You shouldn't use short tags, as it is being removed, and is not very portable. 3. You need to use the POST array to set the checked value. 4. You need to know which checkbox you are inquiring about, so use indexes. Example <input name="status[1]" id="pending" value="Shouldn't be a POST variable" <?php if(isset($_POST['status'][1])) echo 'checked'; ?> />
-
Upload mp4 not working help please all other files work except mp4 help
jcbones replied to Lisa23's topic in PHP Coding Help
Did you echo the type out, and see what it was? I know that IE sents png's as x-png and jpeg's as pjpeg. If I were you, I would echo out the file types (in all browsers) to make sure I covered them all. -
Replace mysql_clean() with mysql_real_escape_string().
-
Yep, both split() and explode() did the same thing, so they dropped split(), same for join() and implode().
-
While viewing the page, highlight the pagination part, right-click select 'view selected source', and copy/paste that here.
-
I would use: <?php $currentDate = date('Y-m-d'); $shippingDate = date('Y-m-d',strtotime('+ 15 days'));
-
Are you asking how to parse a XML file? If so, simplexml should do it.
-
I'm with xyph on this one. You are the store owner, so you should have access to the site. Build you a script that pulls the data you want from the database on site A, then call the script from site B to get the xml. It is like creating your own API.
-
So, $data['listname'] is a string, and $dataList['listname'] is a string, as both are returned in an array, but are NOT arrays themselves.
-
Yes, with the latest version, PHP wants you to specify the timezone with date_default_timezone_set.
-
Or, you could build it in reverse. <?php $Cost = $_POST['fielda']; $Tax = ($Cost * .06); $Sub = ($Cost + $Tax); if ( $Sub > 75.00 ) $Ship= 6.00; elseif ($Sub > 51.00 ) $Ship= 5.00; elseif ($Sub > 26.00) $Ship: 4.00; else $Ship= 3.00; $Total = ($Cost + $Tax + $Ship); print ("Cost : $Cost<br> Tax: $Tax<br> Ship: $Ship<br> Shipping total is $Total"); ?>
-
Run this: <?php $dbhost = "localhost"; $dbuser = "username1"; $dbpass = "password1"; $db = "username1_myDB"; $connection = mysql_connect($dbhost, $dbuser, $dbpass) or die ("Could not connect"); mysql_select_db($connection, $db); $show = "SELECT Name, Description FROM people"; $result = mysql_query($show) or trigger_error(mysql_error()); while($show = mysql_fetch_array($result)){ $field01 = $show[Name]; $field02 = $show[Description]; echo "id: $field01<br>"; echo "description: $field02<p>"; } ?>
-
A date string in the format YYYY-mm-dd works in comparison test, I checked it to make sure.
-
Add the following, right under the opening <?php tag error_reporting(-1); ini_set('display_errors',1);
-
De-bugging added, please copy/paste the error that is printed to the screen. <?php //msut be logged in page session_start(); //display all errors. error_reporting(-1); ini_set('display_errors',1); if ($_SESSION['username']) { echo""; } else die("You must log in first!"); //form information $submit = $_POST['submit']; $row4 = $_SESSION['username']; // form data $link = strip_tags($_POST['link']); $message = strip_tags($_POST['message']); $title = strip_tags($_POST['title']); $author = strip_tags($_POST['author']); $date = date('Y-m-d'); $connect = mysql_connect("db","username","password") or die("Not connected"); mysql_select_db("username") or die("could not log in"); $querycheck = "SELECT * FROM boox WHERE username='$row4'"; $result = mysql_query($querycheck) or trigger_error(mysql_error()); //error trigger added. while($rowz = mysql_fetch_array($result)) $linkcheck = $rowz['link']; if ($submit) { if($link&$title&$author) { // check username and subject lentgh if ($linkcheck == $link) { die ("This link has already been posted."); } else { //database is already open $queryreg = mysql_query("INSERT INTO boox Values ('','$row4','$link','$title','$author','$message','$date')") or trigger_error(mysql_error()); //added a error trigger on query failure. echo "You have just officialy posted on the Catalina Beat Mixers. "; } } } else { die ("You forgot to put something in the link/title/author box."); } ?> [code]
-
Find First Sentence without including decimals
jcbones replied to brooksh's topic in PHP Coding Help
So, you need to find ONLY the decimal that has a space after it? You will still have to think about abbreviations. -
Lets look at your theory, because I'm with PFM on this one. The if statement should compare those dates correctly. <?php //according to your output. $today = 2011-10-10; $firstday = 2011-08-28; $lastday = 2011-10-01; //so if statement would be: if(2011-08-28 is greater than or equal to 2011-10-10 AND 2011-10-01 is less than or equal to 2011-10-10) //is 2011-08-28 greater than 2011-10-10 == FALSE //AND //is 2011-10-01 less than 2011-10-10 == TRUE So the if statement fails, because one condition is false.
-
Lets see the form that posts to this page.
-
To keep the items after page re-fresh, you would need to create a SESSION, COOKIE, or fill with a database pull. Since you are adding them to the DB, I would suggest pulling them from the DB.
-
You need to change the amperstand (&) to & You can do this with str_replace;
-
Try using strrpos() to get the last amperstand. <?php $attrs = $media->group->player->attributes(); $watch = substr($attrs['url'],0,strrpos($attrs['url'],'&'));
-
If you need anything further, please feel free to ask.