Jump to content

computermax2328

Members
  • Posts

    281
  • Joined

  • Last visited

Everything posted by computermax2328

  1. Hello Again, I have a data base that is full of averages, for example (.124). They are stored in the database like this (0.124). Of course without the parentheses on each example. I am using an equation to get these numbers and just for the record the equation is not the problem. To get rid of the leading zero in (0.124) I am using ltrim. For example: $num = 0.124; ltrim($num, 0); Now my equation is giving me negative numbers, which is fine. The problem is that the ltrim command is not working on the negative numbers. The number I am getting when I output is (-0.124). I want the number to be (-.124). Any suggestions??
  2. Thank you! I do that all the time by accident
  3. Could someone take a look at this and tell me what I am missing or spelled wrong? None of the echos in the HTML are working. Thanks in advance! <section> <?php $id = $_GET['id']; $query = "SELECT * FROM blog WHERE id=$id"; $select = mysql_query($query); if (!$select) { echo "Query did not work" . mysql_error(); } $row = mysql_fetch_array($select); if (!$row) { echo "fetch did not work" . mysql_error(); } while ($row) { $count = $row['count']; $date = $row['Date']; $title = $row['Title']; $sub = $row['Subtitle']; $author = $row['Author']; $content = $row['Content']; } $addcount = $count + 1; $update = "UPDATE blog SET count=$addcount WHERE id=$id"; $upcount = mysql_query($update); ?> <div id="articlewrap"> <div id="arttitle"> <h1 class="arthead"><?php echo $title;?></h1> </div> <div id="artsub"> <h2 class="artsub"><?php echo $sub;?></h2> </div> <div id="artphoto"> <img class="artphoto" src="#"/> </div> <div id="artinfo"> <p2 class="artauthor"><?php echo $author;?></p2></br> <p3 class="artdate"><?php echo $date;?></p3> </div> <article class="story"> <p class="artcon"><?php echo $content;?></p> </article> </div> </section>
  4. Hello Again, My last post for the night, I swear. I am building a blog and I have blog home page where a while loop outputs previews of all my blog posts. At the bottom of each preview is a "read more" link. Simply, enough I could just create a file called article.php and pass an id with the link to this page and have the id populate the page. Then it dawned upon me, is there a way to use php to create a unique URL for every page for SEO purposes. For example, if I write an article about myself, Max Baldwin, and I want everyone who Googles my name to find this article, Google would find my article if the URL was www.example.com/max-baldwin. How do I get this dynamic URL with the information I already have in my database? Pretty much every article would have unique URL. Does this make sense? Thanks in advance,
  5. Hello Again, I am building a blog and for every time I post in my database I have an auto time stamp that is attached to every entry. When I output the date and time just as a variable I get Y-m-d. Then I tried to use date_format() command. Now I am getting a blank. How can I rearrange my $date variable to the format I need? This is what I used: $date = $row['Date']; $date = date_format("m/d/Y", $date);
  6. Hello All, I am in the process of building a blog and I have a while loop output my blog posts previews on a home page. For example, say I have 30 posts and I want to have 10 on my main page and then have 10 on another and so on. Then there would be buttons at the bottom to go to the next page or the 3rd or 5th page. How could I use php to do this? I have not been able to find any techniques on how to do this. I don't even know what to call it. Thanks in advance,
  7. Hello, In phpmyadmin I need the database to store a number like this .345 Right now I am getting 0.345. Any tips on how to change this??
  8. Hello All, Is there anyway to create a table in a form action using MYSQL without using the CREATE command. My host doesnt allow the CREATE command to be used....... I know, that is crap!
  9. Hello again, Just a quick question, I couldn't think of the term to use to google search for this answer. In my MYSQL INSERT or UPDATE command I am getting an error because the name I am trying to insert has a ' in the last name, like O'Riley. What is the command called to filter the ' to be inserted into the database? I couldn't find. Thanks again!
  10. <?php $name = ($_FILES['pic']['name']); $tmp_name = ($_FILES['pic']['tmp_name']); if ($name){ $location = "../photos/$name"; move_uploaded_file($tmp_name, $location); } else { echo "please click back and select a file"; } if (empty($name)) { echo "No file submitted. Please click back and select a file."; } ?>
  11. Hello again, I have something strange going on. I have a form that you can upload a photo with and on my development computer. It uploads the photo to a folder and stores the path name in a mysql database. I upload this to my Bluehost server and now it stores the photo, but wont pass the $name variable. It will pass the path but forget about the $name variable. I keep getting ../photos/ on my database table when I should be getting ../photos/$name variable. Any tips? I messed around with the php.ini file a little bit. Increased max file upload size and the max post size.
  12. The only errors I am getting are from this morning when I was having connection errors. It is really weird. It works on my development computer but not the BlueHost server. I guess it has to be something with the php.ini. I really don't know!
  13. Hello Again, My problem is that on my development computer my php files are executing just fine. When I FTP them to my host, BlueHost, they are not executing the way I want them to. For example, my log in script. When I submit my log in information for my CMS I get bounced back to my log in page. Usually that happens when there is no form action, but there is. I was thinking there might be some configurations to php.ini that I need to make. Any tips?
  14. All of my code is posted above. I just added the ANDs in between the different delete values.
  15. Thanks for taking a look AND thanks for the code tag tip. You see what I did there???? AND. I love code jokes. Anyway! I got something like this now. $query = "DELETE FROM `database` WHERE `a`='$a' AND `b`='$b' AND `c`='$c'"; AND I am not getting anything. Am I executing the query incorrectly? Thanks again,
  16. Hello Again, I think I need a second set of eyes on this one. I did a couple of tests and the $id is passing as a hidden input through the form. I think there is something wrong with my delete query, but I am not really sure. The if statements are working at the end of the page, but the delete query is not happening. Take a look? <?php require("../includes/connection.php"); require("../includes/sessioncheck.php"); ?> <?php $yes = $_POST['delyes']; $no = $_POST['delno']; $id = $_POST['hiddenid']; $select = "SELECT * FROM `database` WHERE id=$id"; if (!$select) { die ("Invaild Query: " . mysql_error()); } $result = mysql_query($select); if (!$result) { echo ("Database Select Failed " . mysql_error()); } $row = mysql_fetch_array($result); if (!$row) { die ("Invaild Fetch: " . mysql_error()); } $a = $row['a']; $b = $row['b']; $c = $row['c']; $d = $row['d']; $e = $row['e']; $f = $row['f']; $g = $row['g']; $h = $row['h']; $i = $row['i']; $j = $row['j']; $k = $row['k']; $l = $row['l']; $m = $row['m']; $delid = $row['id']; ?> <?php $query = "DELETE FROM `database` WHERE `a`='$a',`b`='$b',`c`='$c',`d`='$d',`e`='$e',`f`='$f',`g`='$g',`h`='$h',`i`='$i',`j`='$j',`k`='$k',`l`='$l',`m`='$m',`id`='$delid'"; if ($yes) { mysql_query($query,$connection); header('Location: ../pages/data_DB.php'); } else { echo ("Database Delete Failed " . mysql_error()); } if (empty($yes)) { header('Location: ../pages/data_delete_list.php'); exit; } ?>
  17. Hello again, I want to store an average in MYSQL, for example .897. What data type should I use? I am currently using decimal(10,3), but the database is out putting numbers like 0.897. From my understanding the "m" in decimal(m,0) has to be greater than the "0." Any suggestions??
  18. Thanks for your help, I was making a huge noob mistake, but I fixed it. I was having the form execute the wrong .php file. Makes sense now! Thanks again,
  19. Hello Again, I have an update form inside of a table. On this table there are several editable fields and several read only fields. Right now I have the auto incrementing id of the person being edited set to a hidden value in the form. When I try to pass that id to the .php to execute the database update, it keeps that ID and erases everything else. The table is an automatically created by php, for example: echo "<td><input type='text' name='editrank' readonly='readonly' value='{$row['First Name']}'></td>"; The id is set to: echo "<td><input type='hidden' name='hiddenid' value='{$row['id']}'></td>"; I guess my problem is how to I pass the hidden id value using the method above? Thanks in advanced!
  20. The following code is a line that I have in a form that is inside of a table. The output I am getting is the 'First Name' but also the </td without the last ">" on the end. Am missing a quote or not escaping a quote correctly? Obviously, I need the </td> to be echoed as HTML. echo "<td>" . "<input type=\"text\" name=\"editfirst\" value=" $row['First Name']; "</td>"; Thanks again,
  21. Thank you for the help! Sorry about being a noob. Could you recommend any good books for learning php and MYSQL? I learned from lynda.com, but the guy who teaches it there is TERRIBLE.
  22. Hello again, I am having a hard time with setting an $id variable on a multi-page submission. It is for a form that updates my data base. What is happening is every time I update my database it updates every row with that information, so I realized that I needed an $id variable. The $_GET ['id'] function is working on the form page, but not the capture page. Is there a way to pass the $id variable to the capture page? Thanks again, #noobstatus
×
×
  • 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.