Jump to content

duduwudu

Members
  • Posts

    14
  • Joined

  • Last visited

    Never

About duduwudu

  • Birthday 04/09/1983

Contact Methods

  • Website URL
    http://www.jakcam.co.uk

Profile Information

  • Gender
    Male
  • Location
    Hebden Bridge, UK

duduwudu's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. If its of any interest, here is what this is for http://www.hebdenbridge.com/directory/masterlisting.php Cheers for everyone's help so far
  2. Out of interest (and being a beginner) could you show me how one might integrate that into the code I posted in at the top of the page (I'm such a noob, but willing to learn)
  3. Cheers akitchin. I would like to have an upload image form for the business to upload an image that is then processed for the website, but it's all a bit complicated in the way all the data is received from so many people (many, not so computer literate) so we decided to stay with image urls so that if we need, we can upload images out selves, or just link them through the businesses own website. The same images also appear larger on a second page that just displays their own information. we shall see how it initially works. Thank you very much for the help
  4. Hello, can anyone help? I have a page that displays information from a database of local businesses. One of the pieces of data is an image url which i display as an image. The design of the table that the information goes in is quite tight and so I have set the image size to 100x100. However, most of the images are not a square so a few of them are getting warped or squished. As the images have the potential to be either landscape or portrait I was wandering if there is a bit of script I could use that would resize the image proportionately? I.e. if it is a landscape picture, then the width is set to 100px and if it is a portrait picture then the height is set to 100px. Here is my current code (that also has code so that if the image url is null then it displays a preset picture) <img src="<?php $img = (strlen($row_Businesses['logo_url'])<>0)?$row_Businesses['logo_url']:"nologo.gif"; echo $img; ?>" alt="<?php echo $row_Businesses['name']; ?>" width="100" height="100" border="1" /> I hope this makes sense,any help would be great, Cheers
  5. Solved, it was really pretty simple in the end. Thanks anyway :D:D
  6. just 1 value to search for in both columns. so, if i was searching for the word 'book' it would return any entries from names with the work book in (like 'the book case') and any entries form the type column with the work book in (like 'book restoration')
  7. Hello, I'm currently building a database of local businesses, I'm quite new to using php and mysql. While I'm mostly managing to stumble my through it, a couple of things are confusing me. This is one of the things. If anyone can help, that would be really great. Ok, so I've build a search page, and a results page and it works great but there is one problem. Currently it will only search through the 'name' column, but I'd also like it to search through the 'type' column at the same time. This is the code I'm using to fetch the results $colname_Businesses = "-1"; if (isset($_POST['search_par'])) { $colname_Businesses = $_POST['search_par']; } mysql_select_db($database_HBBA_DATABASE, $HBBA_DATABASE); $query_Businesses = sprintf("SELECT * FROM Businesses WHERE name LIKE %s", GetSQLValueString("%" . $colname_Businesses . "%", "text")); $query_limit_Businesses = sprintf("%s LIMIT %d, %d", $query_Businesses, $startRow_Businesses, $maxRows_Businesses); $Businesses = mysql_query($query_limit_Businesses, $HBBA_DATABASE) or die(mysql_error()); $row_Businesses = mysql_fetch_assoc($Businesses); I'm not sure what to add in to make it also search through the 'type' column or where to put that. Can anyone point me in the right direction? Any help would be most appreciated. Cheers
  8. Hello, I'm sure this is very simple, but as a bit of a beginner I would appreciate any help. I have a page that is pulling information from a database of local businesses. One of the columns is a URL and on the page I have a link 'Visit website' and the url from the database is the link. However, not all the entries in my database have a website and are null. So this is creating the problem that some of my listing have a link that says visit website, that go nowhere. This is the code i am using: <a href="<?php echo $row_Businesses['website']; ?>" target="_blank">Visit Website</a> What I would like is, if the 'website' column is null then the visit website link doesn't appear but if there is an entry for the 'website' column then there is a link saying visit website that has the 'website' column entry as the link (like above). Any help that'll help me understand or get this done would make me a very happy boy Cheers
  9. Hello, I'm sure this is very simple, but I'm just getting started with php and mysql and was wandering if someone could help me with a snipped of code. I have a page that displays information from my database. One of the items it displays is an image. like this: <img src="<?php echo $row_Businesses['logo_url']; ?>" alt="<?php echo $row_Businesses['name']; ?>" width="100" height="100" border="1" /> Now, not all of the rows in my database have an entry for 'logo_url' and are null. I would like it so that if 'logo_url' is null it will instead show an alternative image called nologo.gif I imagine it would be along the lines of if 'logo_url' = null show nologo.gif else show <?php echo $row_Businesses['logo_url']; ?>. Any help would make me a very happy boy, Cheers
  10. Cheers, Would it be easily implemented into the following? <?php require_once('Connections/JakcamDatabastest.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO businesses (id, name, type, ad1, ad2, ad3, ad4, tel, email, web, photo, info) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['id'], "int"), GetSQLValueString($_POST['name'], "text"), GetSQLValueString($_POST['type'], "text"), GetSQLValueString($_POST['ad1'], "text"), GetSQLValueString($_POST['ad2'], "text"), GetSQLValueString($_POST['ad3'], "text"), GetSQLValueString($_POST['ad4'], "text"), GetSQLValueString($_POST['tel'], "text"), GetSQLValueString($_POST['email'], "text"), GetSQLValueString($_POST['web'], "text"), GetSQLValueString($_POST['photo'], "text"), GetSQLValueString($_POST['info'], "text")); mysql_select_db($database_JakcamDatabastest, $JakcamDatabastest); $Result1 = mysql_query($insertSQL, $JakcamDatabastest) or die(mysql_error()); $insertGoTo = "showall.php"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); } ?><!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>Untitled Document</title> </head> <body> <p>Add a new listing</p> <form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1"> <table align="center"> <tr valign="baseline"> <td nowrap="nowrap" align="right">Business Name:</td> <td><input type="text" name="name" value="" size="32" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">Catagory:</td> <td><input type="text" name="type" value="" size="32" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">Address line 1:</td> <td><input type="text" name="ad1" value="" size="32" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">Address line 2:</td> <td><input type="text" name="ad2" value="" size="32" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">Address line 3:</td> <td><input type="text" name="ad3" value="" size="32" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">Address line 4:</td> <td><input type="text" name="ad4" value="" size="32" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">Tel:</td> <td><input type="text" name="tel" value="" size="32" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">Email:</td> <td><input type="text" name="email" value="" size="32" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">Web:</td> <td><input type="text" name="web" value="" size="32" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">Image URL:</td> <td><input type="text" name="photo" value="" size="32" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right">Extra Info:</td> <td><input type="text" name="info" value="" size="32" /></td> </tr> <tr valign="baseline"> <td nowrap="nowrap" align="right"> </td> <td><input type="submit" value="Insert record" /></td> </tr> </table> <input type="hidden" name="id" value="" /> <input type="hidden" name="MM_insert" value="form1" /> </form> <p> </p> </body> </html>
  11. Hello, I've been building a test version of an on-line local business directory. (using php and mysql) It's going really well (especially as I'm still a beginner really). So far I've got some information in my database, a search page, master listing, admin area for editing the information and I've also created a page for adding new entries to the database. So far it's all working very well but I would like to make an addition... On the page where you can add new entries to the database, one of the text fields is for an image url. I'd like to be able to change this to an option that would let you upload in an image from your computer to the server, and take the location of the image on the server and put that in the database. Apologies if this isn't too clear, I've not done this before so I am not sure how easy would this be to do? Can anyone offer any help or advice? I'd be very greatfull if you could. Cheers
×
×
  • 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.