Jump to content

kasitzboym

Members
  • Posts

    26
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

kasitzboym's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. You know what i figured figured it out... i dont know why but it didnt like the number in the if statement i changed it to this and i had the variable set like $size = $_FILES["upload"]["size"]; i just type it like that when i was on here... but changing it to a variable seamed to have worked... ill have to do more reading on it maybe it is a bug in PHP they haven't found yet or something... But Anyway thanks for the help!!! $size = $_FILES["upload"]["size"]; $max_file_size = 1024000; if($size > $max_file_size){ echo'entered if statement<br />'; } else{ echo'entered else statement<br />'; }
  2. Thanks but im having more trouble with this than i am with my if else statement... If i take out the statement and just echo $_FILES["upload"]["size"] then it prints out the file size every time its just when i have it in an if statement that it has trouble. Any other ideas? i really would like to use this setup.
  3. I am trying to check to see if a file size is acceptable before an upload but cant seem to get the right result no matter what i do. if i have my if statement below coded like this if($_FILES["upload"]["size"] < 1024000){ echo'entered if statement<br />'; } else{ echo'entered else statement<br />'; } Then i always am entereing the if statememnt but if i have my if statement like this if($_FILES["upload"]["size"] > 1024000){ echo'entered if statement<br />'; } else{ echo'entered else statement<br />'; } then i always seem to enter the else staement. I have tried with a VIREITY of differnt size files some from like 2kb to 10mb... i believe somewhere near the > or < is my problem but i dont seem to see it
  4. Hey guys there is probably a simple fix to this but i am just not seeing it ... Im createing a form that has error catching and self submitting valuse. I am trying to use a for loop to create all of the values and if the form is returned with an error then the correct values will still be filled out but i cant seem to get this loop to work. Every time i submit the form it doesnt matter what option i select it always comes back with the last one in the list or 30 in this case. the problem code is below.. Any help would be appreciated. <?php for($i=1; $i<=30; $i++){ echo'<option value="'.$i.'"'; if(isset($_POST['petsAge'])== $i){ echo ' selected="selected"';} echo '>'.$i.'</option>'; } ?>
  5. That kind of makes since. Although i am kind of lost on the syntax that you are explaining do you mean someting like this? <?php require("includes_database/mysqli_connect.php"); //$query="SELECT * FROM phpbb_topics WHERE (forum_id='13' OR forum_id='14') AND topic_status = '0'"; //$query2="SELECT * FROM phpbb_topics WHERE (forum_id='15' OR forum_id='16') AND topic_status = '0'"; $query="SELECT * FROM phpbb_topics WHERE (forum_id='13' OR forum_id='14')"; $query2="SELECT * FROM phpbb_topics WHERE (forum_id='15' OR forum_id='16')"; $result=mysqli_query($dbc, $query); $result2=mysqli_query($dbc, $query2); $num = mysqli_num_rows($result); $num2 = mysqli_num_rows($result2); echo''.count($num).'<br>'; echo''.count($num2).'<br>'; echo "<table border=1 cellpadding=2>"; echo "<tr><td>Lost</td><td>Found</td></tr>"; while(($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) && ($row2 = mysqli_fetch_array($result2, MYSQLI_ASSOC))) { echo'<tr>'; if ($row){ while($row = mysqli_fetch_array($result, MYSQLI_ASSOC)){ echo "<td width='15%'><a href=/sahbb/viewtopic.php?f=".$row['forum_id']."&t=".$row['topic_id'].">".$row['topic_title']."</a></td>"; } } if($row2){ while($row2 = mysqli_fetch_array($result2, MYSQLI_ASSOC)){ echo "<td width='15%'><a href=/sahbb/viewtopic.php?f=".$row2['forum_id']."&t=".$row2['topic_id'].">".$row2['topic_title']."</a></td>"; } } echo'</tr>'; } echo "</table>"; mysqli_free_result($result); mysqli_free_result($result2); mysqli_close($dbc); ?>
  6. This seems to have returned the same result as my version. ManiacDan I will try this however i would like to keep a single table with two columns instead of splitting them up They are currently using the same div tag as they are both in a marque that scrolls.
  7. Hey everyone I've been working on converting my old mysql code to to the mysqli version and am running into some trouble. I am pulling posts form phpbb and displaying them in a script. My first script below works just fine. <?php require("connect.php"); $query="SELECT * FROM phpbb_topics WHERE (forum_id='13' OR forum_id='14') AND topic_status = '0'"; $query2="SELECT * FROM phpbb_topics WHERE (forum_id='15' OR forum_id='16') AND topic_status = '0'"; $result=mysql_query($query); $result2=mysql_query($query2); echo "<table border=0 cellpadding=2>"; echo "<tr><td>Lost</td><td>Found</td></tr>"; while($row=(mysql_fetch_array($result)) || $row2=(mysql_fetch_array($result2))) { $forum_id=mysql_result($result,$k,"forum_id"); $topic_id=mysql_result($result,$k,"topic_id"); $topic_title=mysql_result($result,$k,"topic_title"); $forum_id2=mysql_result($result2,$k,"forum_id"); $topic_id2=mysql_result($result2,$k,"topic_id"); $topic_title2=mysql_result($result2,$k,"topic_title"); echo "<tr><td width='15%'><a href=/sahbb/viewtopic.php?f=$forum_id&t=$topic_id>$topic_title</a></td> <td width='15%'><a href=/sahbb/viewtopic.php?f=$forum_id2&t=$topic_id2>$topic_title2</a></td> </tr>"; $k++; } echo "</table>"; mysql_close($connect); ?> however its not very clean or memory efficient so i have converted it to the following. <?php require("includes_database/mysqli_connect.php"); $query="SELECT * FROM phpbb_topics WHERE (forum_id='13' OR forum_id='14')"; $query2="SELECT * FROM phpbb_topics WHERE (forum_id='15' OR forum_id='16')"; $result=mysqli_query($dbc, $query); $result2=mysqli_query($dbc, $query2); echo "<table border=1 cellpadding=2>"; echo "<tr><td>Lost</td><td>Found</td></tr>"; while(($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) || ($row2 = mysqli_fetch_array($result2, MYSQLI_ASSOC))) { echo "<tr><td width='15%'><a href=/sahbb/viewtopic.php?f=".$row['forum_id']."&t=".$row['topic_id'].">".$row['topic_title']."</a></td> <td width='15%'><a href=/sahbb/viewtopic.php?f=".$row2['forum_id']."&t=".$row2['topic_id'].">".$row2['topic_title']."</a></td> </tr>"; } echo "</table>"; mysqli_free_result($result); mysqli_free_result($result2); mysqli_close($dbc); ?> I know the error is in my while loop but i cant seem to figure out exactly where. The new code displays all of the first query in the table and then below that it displays the next query insted of displaying them side by side below would be an example of what is happening [table Lost Found Lost, Australian Sheppard [/td] Lost German Shepherded / Collie Mix Lost Golden Retriever/Cocker Mix Lost Female Grey Tiger Lost Pitbull Mix Lost 2 Chihuahua Lost Black Lab Lost - German Shepard Mix and Lab Mix Lost - Female German Sheperd Aprox 8 Week Old Kitten Found! 2 Pugs FOUND Found 1 Corgi female/ 1 Shih Tzu male Found Tan and Black Australian Shepard Found Australian Shepard [td]Found Intact Male Pitbull/Lab Mix Any help that any of you could provide would be greatly appreciated!
  8. While working hard at trying to figure this out, I DID! Just for anyone who wants future reference here is what I did. I had my table separated into id--INT---auto Increment--just a unique id number event--TEXT--- title of the event to be displayed month--INT--- month event happens in day--INT---- day event happens in display--TEXT--- actual text to display on the site I figured it would be easier to read out the individual cells instead of an actual formatted date because im not yet familiar with it. I then looped through all of the rows to put it into an array and while inside the While loop i created an if statement that compared the month of the browser to the month colume of the table in MySQL. I then echoed the text in the display cell in the table into the website. <?php require("connect.php"); $sql="select * from yearly_anouncements"; $result=mysql_query($sql, $connect); $i=0; $monthd = date("n"); // if($monthd = "$month"){ while ($row=(mysql_fetch_array($result))) { $id=mysql_result($result,$i,"id"); $event=mysql_result($result,$i,"event"); $month=mysql_result($result,$i,"month"); $day=mysql_result($result,$i,"day"); $display=mysql_result($result,$i,"display"); $i++; if($monthd == "$month"){ echo "".$row['display'].""; } } ?> Thanks for the help anyway everyone!!
  9. Hello, I hope someone can help me out with this as i am out of ideas. I was trying to use today's date to display a message based on the information pulled from a MySQL database. As of right now i have it displaying absolutely everything in the database which is not what i want. Below is what i have so far to display at least something. <?php require("connect.php"); $sql="select * from yearly_anouncements"; $result=mysql_query($sql, $connect); $i=0; $month = date("m"); if($month = "07"){ while ($row=(mysql_fetch_array($result))) { $id=mysql_result($result,$i,"id"); $event=mysql_result($result,$i,"event"); $month=mysql_result($result,$i,"month"); $day=mysql_result($result,$i,"day"); $display=mysql_result($result,$i,"display"); echo "".$row['display'].""; $i++; } } ?> Right now i want it to pull in anything to do with the month of JULY which right now is just the phrase for INDEPENDENCE DAY! could anyone help me figure out where i am going wrong? Thanks in advance.
  10. Thanks for the advice... Ive looked over the Session commands but dont quite understand how they work... could someone help me to understand how to pull that username from the current session
  11. Sorry i dont quite understand... This is getting a little more advanced than im used to do you think you might be able to explain it a little to me please?
  12. Hi everyone... I have kind of a complicated problem that i hope someone can help me with. I have a registration section of my site already up and running... i am trying to create another section of my site so that the user that is logged in can create a posting and link it to their username.... currently i have two tables in a mysql database one named (users) to hold the username and password that i want to pull the username from and another that holds the information for posting called (laf).... My basic question is how can i pull the username from the (users) database and place it into the (laf) database when they post? This is a really hard thing to explain i know, if anyone can help or needs any more information let me know... Thanks in advance
×
×
  • 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.