Jump to content

bluewaves

Members
  • Posts

    32
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

bluewaves's Achievements

Member

Member (2/5)

0

Reputation

  1. I am unfortunately using an old version of phpmyadmin and mysql. What is really very easy to do in current versions is making me pull my hair out with this old version. MySQL - 3.23.58 phpMyAdmin - 2.8.2.4 When I try to use the import feature, I get this error message when using CSV LOAD Data '/tmp/phpkloqCK' must be in the database directory or be readable by all I haven't a clue where that file is located or how to change permissions on it. Can anyone help? Thanks.
  2. I was able to solve this problem. <img src='" . $list['image'] . "' alt='" . $list['name'] . "' border='0' /> That did it. Thanks.
  3. When I use this code, I get error messages in w3 validator that says - required attribute "alt" not specified What would I need to change to get it to recognize the alt tag? <td width='200'><div class='imageBox'><a href='". $list['link'] . "' rel='nofollow' title='" . $list['name'] . "' > <img src=" . $list['image'] . " alt='" . $list['name'] . "' border='0' /> <a href='". $list['link'] . "' rel='nofollow' title='" . $list['name'] . "'> <center><font size='1'><strong>" . $list['name'] . "</a></strong></font></center></td>\n"; ?>
  4. How can I get this to work with this code: <?php include('bbbb.php'); $database = "cxxxxx"; $cxn = mysql_connect($host,$user,$password) or die ("couldn't connect to server"); mysql_select_db($database); $conn = mysql_connect('localhost','x','x') or trigger_error("SQL", E_USER_ERROR); $db = mysql_select_db('coolchec_checks',$conn) or trigger_error("SQL", E_USER_ERROR); // find out how many rows are in the table $sql = "SELECT COUNT(*) FROM table WHERE Type='movie' ORDER BY ProductID DESC"; $result = mysql_query($sql, $cxn) or trigger_error("SQL", E_USER_ERROR); $r = mysql_fetch_row($result); $numrows = $r[0]; // number of rows to show per page $rowsperpage = 30; // find out total pages $totalpages = ceil($numrows / $rowsperpage); // get the current page or set a default if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage'])) { // cast var as int $currentpage = (int) $_GET['currentpage']; } else { // default page num $currentpage = 1; } // end if // if current page is greater than total pages... if ($currentpage > $totalpages) { // set current page to last page $currentpage = $totalpages; } // end if // if current page is less than first page... if ($currentpage < 1) { // set current page to first page $currentpage = 1; } // end if // the offset of the list, based on current page $offset = ($currentpage - 1) * $rowsperpage; // get the info from the db $sql = "SELECT BigImage, Thumbnail, Link, Name, Description, Price FROM table WHERE Type='Movie' ORDER BY ProductID DESC LIMIT $offset, $rowsperpage"; $result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR); define ("NUMCOLS", 1); $res = mysql_query("SELECT BigImage, Thumbnail, Link, Name, Description, Price FROM gobble WHERE Type='Movie' ORDER BY ProductID DESC"); $count = 0; echo "<table cellpadding='10'>"; while ($list = mysql_fetch_assoc($result)) { if ($count % NUMCOLS == 0) echo "<tr>\n"; # new row echo "<td><a href='". $list['Link'] . "' rel='nofollow' title='" . $list['Name'] . "' target='_blank'> <span class='floatleft'><img src=" . $list['BigImage'] . " alt='" . $list['Name'] . "' border='0' /><br /> <font face='arial' size='1'>" . $list['Name'] . "</a><br />" . $list['Description'] . "</font></span></td>\n"; $count++; if ($count % NUMCOLS == 0) echo "</tr>\n"; # end row } # end row if not already ended if ($count % NUMCOLS != 0) { while ($count++ % NUMCOLS) echo "<td> </td>"; echo "</tr>\n"; } echo "</table>"; /****** build the pagination links ******/ // range of num links to show $range = 4; // if not on page 1, don't show back links if ($currentpage > 1) { // show << link to go back to page 1 echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=1'><<</a> "; // get previous page num $prevpage = $currentpage - 1; // show < link to go back to 1 page echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$prevpage'><</a> "; } // end if // loop to show links to range of pages around current page for ($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++) { // if it's a valid page number... if (($x > 0) && ($x <= $totalpages)) { // if we're on current page... if ($x == $currentpage) { // 'highlight' it but don't make a link echo " [<b>$x</b>] "; // if not current page... } else { // make it a link echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$x'>$x</a> "; } // end else } // end if } // end for // if not on last page, show forward and last page links if ($currentpage != $totalpages) { // get next page $nextpage = $currentpage + 1; // echo forward link for next page echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$nextpage'>></a> "; // echo forward link for lastpage echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$totalpages'>>></a> "; } // end if /****** end build pagination links ******/ ?>
  5. I need to add a function to a php script that calls on a mysql database and displays product images from a datafeed on a web page. I have a variety of image sizes. For example, one image is 400 x 212. When I display it I want it to be a maximum width of 250, then I want the height to be whatever it needs to be to keep it in a similar proportion to the original. Can someone tell me how I would write that into my php script? Thanks.
  6. I developed a site that uses 4 php include files (header, footer, leftside, rightside) What I want to be able to do is to have the right side column read from the header file the topic the page is about and then run a query to display results. For example, say I set a variable on each individual page that is the topic of the page - like "cats" My right side include should put the word cats into it's query so that I can display discounts for cat products. Please let me know if I need to provide other information. Because I don't have experience declaring a variable, I need to know exact code and where on the page it would need to be. My guess is that I could declare the title as a variable, but it would have so many words in it that I wouldn't know how to effective use it. Thanks.
  7. I am using this mysql code on a php webpage: ...WHERE Name LIKE '%hello kitty%' ORDER BY Category What I want to know is this: The field category - is there a way to specify the order in which you want the categories to show up? Right now, all I know how to do is to alphabetize them ASC or DESC. I would like to be able to choose the categories display order without it being alphabetized. Thanks.
  8. How do I set up a redirect? I have some pages on my site that have two pages with essentially the same stuff on it. I really should do a redirect on one of them. If people have bookmarked that url, will the redirect to the other page work without any harm? I also have some html pages that I'd like to redirect to .php extensions. I don't want to suffer any Google penalties for it though. Does anyone feel confident in directing me? Thanks!
  9. would you mind taking a look at the rest of the call. I think my quotes are wrong there too. echo "<td><a href='". $list['Link'] . "' rel='nofollow' title='" . $list['Name'] . "' target='_blank'> <span class='floatleft'><img src=" . $list['BigImage'] . " alt='" . $list['Name'] . "' border='0' /><br /> <font face='arial' size='1'>" . $list['Name'] . "</a><br />" . $list['Description'] . "<br />Price: $" . $list['Price'] . "</font></span></td>\n";
  10. <span class='floatleft'><img src=" . $list['BigImage'] . " alt= 'Girly Checks - ". $list['Name'] . "' border='0' /><br /> I can't figure out how I can get the alt tag to read girly checks and then the name of the item. Can anyone help? I've tried all kinds of variations with the " and the ', but I don't understand the rules that govern their usage. Thanks.
  11. Can someone tell me how to use this API? The base URL for all calls to the Recommended Sites API is http://api.business.gov/license_permit/ The API is RESTful and output formats are available in XML and JSON. I've never written any code that uses an API so if you could just tell me how involved this is or point me to a tutorial, I'd appreciate it. Thanks!
  12. Hi, I am barely functional with php. I know just enough to get by. Are you saying that I set a variable in each script? If so, I need an example because of my lack of knowledge. In the script I am using over and over, This is what determines the columns: define ("NUMCOLS", 3); If there is just one script running on the page, all I do is change the number and that will change the column numbers, but not when several are running on the page. Here are the names of the scripts I just separated out: ../php/hummingbird-checks1.php ../php/hummingbird-col.php ../php/hummingbird-calendars.php Two of them are in the same area so I can call on them like this: <?php include('../php/hummingbird-calendars.php'); include('../php/hummingbird-col.php'); ?> Now if I follow your first layout would the new call look like this? This would have 2 columns: <?php $col_num_var = 2; include('../php/hummingbird-checks1.php'); ?> Then lower in the page, these would have 4 columns: <?php $col_num_var = 4; include('../php/hummingbird-calendars.php'); $col_num_var = 4; include('../php/hummingbird-col.php'); ?> Is that the right logic? Even though my original call on columns looks like this: define ("NUMCOLS", 3); Thank you for your help.
  13. O.k. I will try that. Can you tell me if my strategy needs to be changed? I currently just run the three scripts right on the actual page. Is that a dumb idea? Thanks
  14. I'm running actually three different php scripts on one page. Everything works as far as display products, but what happens is that you can designate the number of columns that the products display on each individual script. So theoretically I should be able to show products in one table and select say 2 columns wide and then use another script for another table and indicate a different column number. The poor result is that the first declaration of the number of columns is what is shown in all three areas where the script runs. It seems to inherit the call from the first script to the next script. Is there any way to stop this from happening? I thought that if I enclosed the script within a table that would stop it, but it doesn't. Any help would be appreciated. Thanks,
  15. I have two scripts that each work fine by themselves. One is a search script with a variable that depends on what people search for. That will display results, but they are in a single column. I want to be able to paginate the results and have 4 columns across. I have a script that will do the pagination and it works by itself. What I want is the search results to be displayed in the 4 columns across with the pagination. I'm not familiar enough with programming to merge these two. Can anyone help me out? Script 1 is the search form. <?php include 'myconnectinfo.php'; $cxn = mysql_connect($host,$user,$password) or die ("couldn't connect to server"); mysql_select_db($database); // $database = "mydatabase_name"; $keyword= $_POST['keyword']; $upperKeyword = strtoupper($keyword); $query = "(SELECT * FROM cjstores WHERE upper(NAME) like '%$upperKeyword%' ORDER BY NAME)"; $result = mysql_query($query) or die ("Couldn't execute query."); if(! $result){ $message = "no results"; } $message = "Sorry, no matching results."; $found = mysql_num_rows($result); if($found == 0){ echo "No products were found with that name. Please try another name."; } /* Display results in a table */ echo "<table cellspacing='10'>"; echo "<tr><td colspan='3'><hr /></td></tr>"; while($row = mysql_fetch_assoc($result)) { extract($row); echo "<TABLE cellpadding='10' width='40%'><tr>\n <td width='200'><img src='$IMAGEURL' border ='0' alt='$NAME'><br clear='all'><P><font size='2'> <a href='$BUYURL'>$NAME</a></td>\n <td width='100'></td>\n </tr>\n"; echo "<tr><td colspan='2'><hr /></td></tr>\n"; } echo "</table>\n"; ?> SCRIPT 2 displays based on my sql query - I want this to be base on the user input? <?php include('myconnectinfo.php'); $database = "giftidea_gifts"; $cxn = mysql_connect($host,$user,$password) or die ("couldn't connect to server"); mysql_select_db($database); $conn = mysql_connect('localhost','user','pass') or trigger_error("SQL", E_USER_ERROR); $db = mysql_select_db('databasename',$conn) or trigger_error("SQL", E_USER_ERROR); // find out how many rows are in the table $sql = "SELECT COUNT(*) FROM cjstores WHERE ADVERTISERCATEGORY LIKE '%Necklaces & Pendants%'"; $result = mysql_query($sql, $cxn) or trigger_error("SQL", E_USER_ERROR); $r = mysql_fetch_row($result); $numrows = $r[0]; // number of rows to show per page $rowsperpage = 4; // find out total pages $totalpages = ceil($numrows / $rowsperpage); // get the current page or set a default if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage'])) { // cast var as int $currentpage = (int) $_GET['currentpage']; } else { // default page num $currentpage = 1; } // end if // if current page is greater than total pages... if ($currentpage > $totalpages) { // set current page to last page $currentpage = $totalpages; } // end if // if current page is less than first page... if ($currentpage < 1) { // set current page to first page $currentpage = 1; } // end if // the offset of the list, based on current page $offset = ($currentpage - 1) * $rowsperpage; // get the info from the db $sql = "SELECT BUYURL, IMAGEURL, NAME, DESCRIPTION FROM cjstores WHERE ADVERTISERCATEGORY LIKE '%Necklaces & Pendants%' LIMIT $offset, $rowsperpage"; $result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR); define ("NUMCOLS", 4); $res = mysql_query("SELECT BUYURL, IMAGEURL, NAME, DESCRIPTION FROM cjstores WHERE ADVERTISERCATEGORY LIKE '%Necklaces & Pendants%'"); $count = 0; echo "<table class='mytable' width='60%' cellpadding='0' cellspacing='0'>"; while ($list = mysql_fetch_assoc($result)) { if ($count % NUMCOLS == 0) echo "<tr>\n"; # new row echo " <td align='center' valign='top' class='mytable'><a href=". $list['BUYURL'] . " class='mypage'><img src=" . $list['IMAGEURL'] . " border='0' alt='NAME'><br><font face='arial' size='1'>" . $list['NAME'] . "</a><br><table><tr><td><font size='1'></td><tr></table></td>"; $count++; if ($count % NUMCOLS == 0) echo "</tr>\n"; # end row } # end row if not already ended if ($count % NUMCOLS != 0) { while ($count++ % NUMCOLS) echo "<td> </td>"; echo "</tr>\n"; } echo "</table>"; /****** build the pagination links ******/ // range of num links to show $range = 4; // if not on page 1, don't show back links if ($currentpage > 1) { // show << link to go back to page 1 echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=1'><<</a> "; // get previous page num $prevpage = $currentpage - 1; // show < link to go back to 1 page echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$prevpage'><</a> "; } // end if // loop to show links to range of pages around current page for ($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++) { // if it's a valid page number... if (($x > 0) && ($x <= $totalpages)) { // if we're on current page... if ($x == $currentpage) { // 'highlight' it but don't make a link echo " [<b>$x</b>] "; // if not current page... } else { // make it a link echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$x'>$x</a> "; } // end else } // end if } // end for // if not on last page, show forward and last page links if ($currentpage != $totalpages) { // get next page $nextpage = $currentpage + 1; // echo forward link for next page echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$nextpage'>></a> "; // echo forward link for lastpage echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$totalpages'>>></a> "; } // end if /****** end build pagination links ******/ ?> Thank you,
×
×
  • 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.