Jump to content

mdmartiny

Members
  • Posts

    188
  • Joined

  • Last visited

Everything posted by mdmartiny

  1. I do not know I will open it up and look to see
  2. This is my config file <?php function connect() { $host = 'localhost'; $username = 'root'; $dbname = 'michael48060'; $dbpassword = ''; $connection = mysql_connect($host, $username, $dbpassword); $db = mysql_select_db($dbname, $connection); if (!$connection) { die('Could not make a connection to MySql Database' . mysql_error()); } if (!$db) { die('Could not connect to DB $dbname' . mysql_error()); } } function counter () { $pagename = $_SERVER["REQUEST_URI"]; $result = mysql_query("SELECT * FROM counter WHERE pagename ='$pagename' "); if (mysql_num_rows($result)==0) { mysql_query("INSERT into counter(pagename,hits) VALUES ('$pagename', '1')"); } else { mysql_query("UPDATE counter SET `hits` = `hits` + 1 where pagename = '$pagename'"); } } ?>
  3. When I put all my code in one file, everything runs smooth, as soon as I try to put a chunk of code in a separte PHP file and use an include or require_once I get the error Assigning the return value of new by reference is deprecated in...PEAR\config.php yadda yadda I've done some research and I understand that passing an object by reference (&obj) is no longer acceptable in PHP 5, that's fine, but no where in my code do I have an ampersand, and again, it all works fine if it's all in the same .php file. So i figure i might be doing something wrong with my includes or something. The errors that I am getting are Deprecated: Assigning the return value of new by reference is deprecated in C:\xampp\php\PEAR\Config.php on line 80 Deprecated: Assigning the return value of new by reference is deprecated in C:\xampp\php\PEAR\Config.php on line 166 Deprecated: Assigning the return value of new by reference is deprecated in C:\xampp\php\PEAR\Config\Container.php on line 111 include('config.php'); connect(); while ($row = mysql_fetch_assoc($ran_result)) { $ran_image = $row['image']; $category = $row['category']; $last = $row['l_name']; $first = $row['f_name']; $return = $row['item_return']; } echo "<div id='random'>\n"; echo "<h1>Random Signatures</h1>\n"; echo "<img src='../auto_images/$ran_image' /><br />\n"; echo "<p><a href='../auto_pages/signatures.php?c=$category&l=$last&f=$first'>$first $last</a></p>\n"; echo "<p>$return</p>\n"; echo "<br>"; echo "</div>"; ?> Am I doing something wrong with the include?
  4. I understand the join function to a point. However I want all of the information to be displayed from the 90toppstraded database. It is a checklist of sorts. I want it to show what signatures I have and what signatures I still need to complete the list. Is there a way that I can do that? I am pretty new to MySQL and I understand the basics of it. So excuse me for my ignorance on this matter
  5. Ok I will try and clarify it up some. I have two databases 90toppstraded and ttmautos. In the 90toppstraded database their is a field called signed that gets a variable of either 1 or 0. In the ttmautos database their is a field called project that has different data in it based on the project. What I am want to do is fill the signed field of 90toppstraded with a one every time that the project field of the ttmautos database says "1990 Topps Traded". I am hoping to do this with out having to enter it manually every time.
  6. I am fairly new to MySQL so I am still learning things. I have two tables one is a numbered checklist(1990ToppsTraded) and the other is a table(ttmautos) filled with different types of information. Depending on what is put in a certain field(collection) of ttmautos. If the collection field says "1990 Topps Traded" it will place a 1 in the signed field of 1990ToppsTraded. Is there a way for me to do this in the database or do I have to do it through a SQL Query in my page? How would I do it either way. Any Help would be appreciated in this manner
  7. That worked perfectly..... Now I am going to break it down and see how it works
  8. I am trying to write some code for my website. I pull information out of a database using a while loop. What am I trying to figure out is how to change some of the information. Some of the information used by the database is not there. It is not there cause I lost it and don't know what to put in place. The missing information is a Date Field. In the database if the field is blank it displays 0000-00-00. On the page it displays 01-01-1970. What I want to do is when the date is 01-01-1970 it actually shows N/A. How would I go about doing this? This is the code that I am using to draw the information from the database. if ($year == 'other') { $sqlC = "SELECT * FROM `ttmautos` WHERE YEAR(date_return) < 2008 ORDER BY `date_return` DESC"; $resultC = mysql_query($sqlC) or die(mysql_error()); if (mysql_num_rows($resultC) == 0) { echo "There currently are no signatures in the database from $year"; } else { $autographs = "<table id='ttm'>\n"; $autographs .= "<tr class='first'><th>Player</th><th>Date Sent</th><th>Date Returned</th><th>Item Signed</th><th>Project</th></tr>\n"; $autographs .= "<tr><td id=\"blank\"></td><td id=\"blank\"></td><td id=\"blank\"></td><td id=\"blank\"></td><td id=\"blank\"></td></tr>\n"; while ($row = mysql_fetch_assoc($resultC)) { $category = $row['category']; $fname = $row['f_name']; $lname = $row['l_name']; $dsent = date('m-d-Y', strtotime($row['date_sent'])); $dreturn = date('m-d-Y', strtotime($row['date_return'])); $ireturn = $row['item_return']; $project = $row['project']; $autographs .= "<tr><td class=\"auto_cell\">$fname $lname</td>"; $autographs .= "<td class=\"auto_cell\">$dsent</td>"; $autographs .= "<td class=\"auto_cell\">$dreturn</td>"; $autographs .= "<td class=\"auto_cell\"><a href=\"signatures.php?c=$category&l=$lname&f=$fname\">$ireturn</a></td>"; $autographs .= "<td class=\"auto_cell\"><a href='projects/$project.php'>$project</a></td></tr>\n"; } $autographs .= "</table>"; echo "$autographs"; } } } I hope that I have given enough information to help me out with this issue.
  9. I got it figured out.. I did what you said and made a few other small changes to the code
  10. If I do that.. Then the error moves down to the other $act variables in the code on line 77 and line 88;
  11. This is a little project that I am working on. I keep receiving an error message and I don't see the error. I look over the code and everything looks fine and. it works like it is supposed to but I still have the error message at the top of the page. The error message that I am getting is Notice: Undefined index: act in C:\xampp\htdocs\forum\admin.php on line 63 This is the code that I have written and am currently using. <?php if (!isset($_SESSION['uid']) || (isset($_SESSION['uid']))) { $sql3 = "SELECT admin from `users` where `id` = '" . $_SESSION['uid'] . "'"; $result3 = mysql_query($sql3) or die(mysql_error()); if (mysql_num_rows($result3) == 0) { echo "You are not correctly logged in"; } else { $row2 = mysql_fetch_assoc($result3); if ($row2['admin'] != '1') { echo "You are not permitted to be here"; } else { $act = $_GET['act']; <------------ This is line #63 in my code-----------------------> $acts = array('create_cat', 'create_subcat'); $actions = array('create_cat' => 'Create a Forum Category', 'create_subcat' => 'Create a Forum sub category'); $x = 1; $c = count($actions); foreach ($actions AS $url => $link) { $bull = ($x == $c) ? "" : " • "; echo "<a href=\"admin.php?act=" . $url . "\">" . $link . "</a>" . $bull . ""; $x++; } echo "<br />"; if (!$act || !in_array($act, $acts)) { echo "Please choose an option from above to continue"; } else { if ($act == 'create_cat') { if (!isset($_POST['submit'])) { echo "<table border=\"0\" cellspacing=\"3\" cellpadding=\"3\">\n"; echo "<form method=\"post\" action=\"./admin.php?act=create_cat\">\n"; echo "<tr><td>Category Name</td><td><input type=\"text\" name=\"name\"></td></tr>\n"; echo "<tr><td>Admin Only?</td><td><input type=\"checkbox\" name=\"admin\" value=\"1\"></td></tr>\n"; echo "<tr><td colspan=\"2\" align=\"right\"><input type=\"submit\" name=\"submit\" value=\"Create Forum Category\"></td></tr>\n"; echo "</form></table>\n"; } else { $name = mss($_POST['name']); $admin = ($_POST['admin']); if ($name) { if (strlen($name) < 3 || strlen($name) > 32) { echo "The name of the category must be between 3 and 32 characters"; } else { $sql4 = "SELECT * FROM `category` WHERE `name` = '" . $name . "'"; $result4 = mysql_query($sql4) or die(mysql_error()); if (mysql_num_rows($result4) > 0) { echo "This Category all ready exsists"; } else { $admin_check = (admin == '1') ? "1" : "0"; $sql5 = "INSERT into `category` (`name`,`admin`) VALUES ('" .$name. "','" .$admin_check. "')"; $res5 = mysql_query($sql5) or die(mysql_error()); echo "This category has been successfully added!"; } } } else { echo "Category name field can not be left blank!"; } } } } } } } echo "$_SESSION[uid]"; ?>
  12. Hello everyone, I am in the process of creating a website that has two different sidebars depending on what page they go to. Is there a way using PHP that I can have the browser pick which sidebar to use. I have seen many tutorials on wordpress doing this but I am tying to do it without word press Thank You
  13. I did not think of using that.. I did that and it worked perfect. Sometime it is the simplest anwers that you never think of
  14. Hey everyone, I am looking for a way to resize images for my website. I have been looking for a script, function, anything that works for a couple of days and nothing has seemed to work the way that I would like it. I am unfamiliar with resizing images using php so I am very confused and completely lost with all of this. I don't want to make a thumbnail and save it in a different directory. I have used the html width="150" height="200" not all of the images are the same size and it makes them look funny. Here is what I have written so far <a href="../../auto_images/<?php echo "$image"; ?>" rel="lightbox-scans"><img src="../../auto_images/<?php echo "$image"; ?>" width="150px" height="200px"/></a><br /> <div id="scans"> <?php if (!$image2 == "") { echo "<a href=\"../../auto_images/$image2\" rel=\"lightbox-scans\"><img src=\"../../auto_images/$image2\" width=\"30px\" height=\"50px\"/></a> "; } if (!$image3 == "") { echo "<a href=\"../../auto_images/$image3\" rel=\"lightbox-scans\"><img src=\"../../auto_images/$image3\" width=\"30px\" height=\"50px\"/></a>"; } ?> I am just looking for a simple way of doing this. Thank You
  15. On the site that I am building. I have several images, some are tall images and some are wide images, I was wondering if there was a way with PHP that I can choose what demonsions are used to display the image based on image pixels? Something like if ($image = 450px ) { display width = "250" height = "150" } else { display width = "150" height = "250" } If there is away how would I go about doing any suggestions?
  16. I figured it out and now I have it working the way that I want. What I ended up doing was changing $dsent = $link['date_sent']; $dreturn = link['date_return']; to $dsent = date('m-d-Y', strtotime($link['date_sent'])); $dreturn = date('m-d-Y', strtotime($link['date_return'])); now it works exactly like I want it to
  17. When I run the query in the mysql database. It returns the faults that I am looking for and formats it the proper way. But when I put the code in php code. It does not show me any results.
  18. Hello Everyone I am working on a website for my favorite hobby. I have created the dynamic pages and they are ready to go. I am having trouble however with the dates. I want all the dates to show up as MM-DD-YYYY. Not sure how to do that with a while loop. I am also trying to figure out how to make the date say "Lost Info" if the date is showing the default.(0000-00-00) Here is my code so far <?php include('../../includes/config.php'); $sql = 'SELECT id, l_name, f_name, date_sent, date_return, item_return FROM `ttmautos` WHERE `l_name` LIKE \'a%\' AND `category` LIKE \'baseball\' ORDER BY `date_return` DESC'; $link_result = mysql_query($sql, $connection) or die(mysql_error()); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <link rel="stylesheet" type="text/css" href="../../css/reset.css"/> <link rel="stylesheet" type="text/css" href="../../css/top_nav.css"> <link rel="stylesheet" type="text/css" href="../../css/main_layout.css"/> <script src="../../scripts/jquery-1.4.4.js" type="text/javascript"></script> <script src="../../scripts/top_nav.js" type="text/javascript"></script> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Baseball Autographs A</title> </head> <body> <div id="wrapper"> <?php include('../../includes/page/header.php'); ?> <?php include('../../includes/page/top_nav.php'); ?> <?php include('../../includes/page/left_sidebar_autopages.php'); ?> <?php include('../../includes/page/right_sidebar.php'); ?> <div id="content"> <ul class="list_heading"> <li class="title">player name</li> <li>date sent</li> <li>date recievied</li> <li class="return">item recievied</li> </ul> <ul class="list"> <?php while ($link=mysql_fetch_array($link_result)){ echo "<li>$link[f_name] $link[l_name]</li> <li>$link[date_sent]</li> <li>$link[date_return]</li> <li class=\"return\"><a href=\"/auto_pages/baseball/baseball-autographs.php?l_name=$link[l_name]&f_name=$link[f_name]\">$link[item_return]</a></li>"; } if($link[date_sent]=="0000-00-00") { echo "Lost Info"; } if (!($link = mysql_fetch_array($link_result))) { return "Currently our database has no autographs listed for here"; } ?> </ul> </div> <!--END content div--> </div> <!--END wrapper div--> <?php include('../../includes/page/footer.php'); ?> </body> </html>
  19. Hello everyone, I am not sure if I am googling this wrong or what. I have several dates in a mysql database that I would like to display in a dynamically made page. Can someone help me or point me in the right direction. I am very unfamiliar with the MySql date function. I would also like to calculate the days that have passed between two different dates. Example would be: 11-27-2011 and 12-15-2011 = # of days
  20. Thanks everyone for your help with this... The problem the whole time was the get function. Stupid Rookie mistake :-\
  21. Ok... I think I have figured out where the problem lies. It is in the $_Get function.. If I go in and type a persons name then the information shows up.
  22. I changed the sql code and added the error message but I am still getting no results or errors <?php include('includes/config.php'); $last = $_GET['l_name']; $first = $_GET['f_name']; $sql = "SELECT * FROM ttmautos WHERE l_name LIKE '$last' AND f_name LIKE '$first' "; $autographs = mysql_query($sql); if (!$autographs) { echo "Could not successfully run query ($sql) from DB: " . mysql_error(); exit; } while ($row = mysql_fetch_assoc($autographs)) { $l_name = $row['l_name']; $f_name = $row['f_name']; $sent = $row['date_sent']; $return = $row['date_return']; $address = $row['address']; $isent = $row['item_sent']; $ireturn = $row['item_return']; $project = $row['project']; $team = $row['team']; } $address = stripslashes($address); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Michael48060's Autographs - <?php echo "$f_name"; ?> <?php echo "$l_name"; ?> Autograph</title> </head> <body> <div id="wrapper"> <h6>Information</h6> <ul> <li><span class="header_two">Player Name</span> – <?php echo "$f_name"; ?> <?php echo "$l_name"; ?></li> <li><span class="header_two">date sent</span> – <?php echo "$sent"; ?></li> <li><span class="header_two">date return</span> – <?php echo "$return"; ?></li> <li><span class="header_two">address used</span> – <?php echo "$address"; ?></li> <li><span class="header_two">item sent</span> – <?php echo "$isent"; ?></li> <li><span class="header_two">item return</span> – <?php echo "$ireturn"; ?></li> <li><span class="header_two">project</span> – <?php echo "$project"; ?></li> <li><span class="header_two">team</span> – <?php echo "$team"; ?></li> </ul> </div> <!--End #content--> </div> <!-- End #wrapper --> </body> </html>
  23. I am doing it further down in the page. That was just the script that I wrote. Here is the full code of everything <?php include('includes/config.php'); $last = $_GET['l_name']; $first = $_GET['f_name']; $sql = 'SELECT * FROM `ttmautos` WHERE `l_name` LIKE \'$last\' AND `f_name` LIKE \'$first\''; $autographs = mysql_query($sql)or die(mysql_error()); while ($row = mysql_fetch_assoc($autographs)) { $l_name = $row['l_name']; $f_name = $row['f_name']; $sent = $row['date_sent']; $return = $row['date_return']; $address = $row['address']; $isent = $row['item_sent']; $ireturn = $row['item_return']; $project = $row['project']; $team = $row['team']; } $address = stripslashes($address); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Michael48060's Autographs - <?php echo "$f_name"; ?> <?php echo "$l_name"; ?> Autograph</title> </head> <body> <div id="wrapper"> <h6>Information</h6> <ul> <li><span class="header_two">Player Name</span> – <?php echo "$f_name"; ?> <?php echo "$l_name"; ?></li> <li><span class="header_two">date sent</span> – <?php echo "$sent"; ?></li> <li><span class="header_two">date return</span> – <?php echo "$return"; ?></li> <li><span class="header_two">address used</span> – <?php echo "$address"; ?></li> <li><span class="header_two">item sent</span> – <?php echo "$isent"; ?></li> <li><span class="header_two">item return</span> – <?php echo "$ireturn"; ?></li> <li><span class="header_two">project</span> – <?php echo "$project"; ?></li> <li><span class="header_two">team</span> – <?php echo "$team"; ?></li> </ul> </div> <!--End #content--> </div> <!-- End #wrapper --> </body> </html>
  24. I modified the code to look like this now and I am still not getting any results.... What am I doing wrong? <?php include('includes/config.php'); $last = $_GET['l_name']; $first = $_GET['f_name']; $sql = 'SELECT * FROM `ttmautos` WHERE `l_name` LIKE \'$last\' AND `f_name` LIKE \'$first\''; $autographs = mysql_query($sql)or die(mysql_error()); while ($row = mysql_fetch_assoc($autographs)) { $l_name = $row['l_name']; $f_name = $row['f_name']; $sent = $row['date_sent']; $return = $row['date_return']; $address = $row['address']; $isent = $row['item_sent']; $ireturn = $row['item_return']; $project = $row['project']; $team = $row['team']; } $address = stripslashes($address); ?>
  25. It is not showing any of the fields that I am trying to get information from. I was echoing out the $autographs query to see what the results are. Every row should post information pertaining to that certain field onto a web page and I am not getting anything. Just the resource id Sorry if I was not clear enough in the first posting.
×
×
  • 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.