Jump to content

ukweb

Members
  • Posts

    119
  • Joined

  • Last visited

    Never

Everything posted by ukweb

  1. Hi Keith! Yes they are exactly the same, its a dropdown box that populates the category name. strange!
  2. Hey peeps I'm really tearing my hair out over this one!! I am developing a system at work. One table stores motorcycles, another stores their categories. Each bike can have many categories, hence the different tables. RIGHT.... The system has to produce a stock list, and it lists bikes for each category. This is my SQL for the query to return a list of categories... $query_stock_cat_list = sprintf("SELECT vehicle_categories.name AS name FROM vehicle_categories LEFT JOIN vehicle_list ON vehicle_list.vehicle_id = vehicle_categories.vehicle_id WHERE vehicle_list.condition = %s GROUP BY vehicle_categories.name", GetSQLValueString($condition, "text")); $stock_cat_list = mysql_query($query_stock_cat_list, $sql) or die(mysql_error()); $row_stock_cat_list = mysql_fetch_assoc($stock_cat_list); $totalRows_stock_cat_list = mysql_num_rows($stock_cat_list); When I run the script it lists the categories (good times) but repeats them so the 'Group by' does not appear to be working, bad times... the returned values are below, not sure what relevance that has but will include the results anyway... Used Honda Used Honda Used European Used Honda Used European Used Japanese ANY help will be received with a lot of gratitude! Ste xx
  3. Hi I have constructed the following .htaccess file: RewriteEngine on RewriteRule ^dir/([0-9]+)/?$ /index.php?file=$1 [L] Options +FollowSymLinks RewriteCond %{HTTP_HOST} ^colwynbayhonda.com RewriteRule (.*) http://www.colwynbayhonda.com/$1 [R=301,L] RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/ RewriteRule ^index\.php$ http://www.colwynbayhonda.com/ [R=301,L] AddHandler php5-script .php ...And MOST of it works lovely! However, my page queries follow the following pattern: mysite.com/index.php?file=<filename> line 2 of the .htaccess is meant to allow the following ruleset: mysite.com/<filename> would point to mysite.com/index.php?file=<filename> but it dont bloody work!!! any ideas? Thanks in advance Ste x
  4. Hi It could be that the PHP file is not running through the webserver, and is instead being opened directly from your HDD. you need to access PHP files through the local web server, usually something like 'http://localhost/myfile.php' instead of opening the file direct from explorer.
  5. Hi All, I have a couple of questions. I have made a script (which works) to send HTML formatted email, problem is every instance of an ' appears as \' instead! So instead of "We're taking orders..." it appears as "We\'re taking orders..." once the email has been received. Any ideas how to put this right???
  6. Hi I have very little experience in Javascript, but basically I have a dropdown menu with a list of manufacturers, and if the manufacturer is not listed, I want a text box to go from a disabled state to an enabled state when 'other' is selected in the dropdown. Any ideas how? I know this isnt PHP but its PHP i am familiar with, and I don;t have a clue of any forums which specialise in javascript!
  7. ukweb

    MySQL hosts

    Hi, I'm a Media Temple customer, and on the whole I'm very happy with them. The one thing which is really annoying me is their MySQL implementation - its really poor. I'm having no end of connection problems, and they can't give me a reason why, only that it is 'a known problem with the connection pool' whatever that means. Anyway, like I say to them, I am not interested in that stuff, I just want it to work. Does anyone know of any MySQL database hosts? I will keep all other operations with Media Temple, I just want someone else to host my databases. Any recommendations, or any experiences with MySQL only hosting would be received gratefully.
  8. Worked it out! I put 'desc' instead of desc in the query and it worked. not sure why this didnt show when I ran the query outside the function though!
  9. Already got it there, no luck ??? I tried changing my php.ini too to show all errors with no luck! rubbish!!! Think error reporting is working ok too because its displaying notice for a variable without a value, and did show up a parse error when I was writing the function and forgot a '}' bit confused.com on this one. the query works fine too, tried running the query outside a function and it did return the db values.
  10. Hi Php only handles the operations, like an engine in a car. HTML, CSS, javascript etc does the cosmetic bits, like a car's bodywork. Take a look at http://www.methvin.com/jquery/jq-corner-demo.html if you use a jquery based solution you'll get some nice results across all browsers. Another way to do it could be makes some rounded corners in Fireworks > export in PNG or GIF with transparency, and position absolute using CSS. Thats the way I do it anyway. If you want me to make you up the images I can send them across to you. Good luck!
  11. Hi peeps, I'm making results from a query build an array, and I'm having problems with it but strangely, PHP is not outputting any notices, errors or warnings, it just returns a blank page. error reporting is on in my config, but I can;t see whats up with my code Basically the results from a query are to be put into a multidimensional array, and like I say as far as I can see i have coded correctly, so cant see whats up! Any ideas or suggestions are welcome! heres the code: // Function to Generate an array for the language list function lang_list() { global $database_sql, $sql; mysql_select_db($database_sql, $sql); $query_langs = "SELECT short_name AS name, long_name AS desc FROM languages"; $langs = mysql_query($query_langs, $sql) or die(mysql_error()); $row_langs = mysql_fetch_assoc($langs); $totalRows_langs = mysql_num_rows($langs); $languages = array(); if ($totalRows_langs == 0) { $languages = false; } else { do { $languages[] = array("name" => $row_langs['name'], "description" => $row_langs['desc']); } while ($langs = mysql_fetch_assoc($langs)); } return $languages; } THis bit is just to see if its working ok: $lang_list = lang_list(); if (!($lang_list == false)) { $rows = count($lang_list); print_r $lang_list; print "number of rows ".$rows; } Thanks again Stephen
  12. ...That's further up in the 'framework.php' file; $hostname_sql = "localhost"; $database_sql = "db26403_allt"; $username_sql = "root"; $password_sql = "root"; $sql = mysql_pconnect($hostname_sql, $username_sql, $password_sql) or trigger_error(mysql_error(),E_USER_ERROR); This is why I cant understand it, everything is there and it does appear to be coded correctly. No other scripts are having problems just this one...
  13. Hi I have a CMS system which I am slowly replacing with a new version which is basically coded better for speed improvements. One part just wont work though. this chunk of code is in a file called 'framework.php' and is required by 'index.php'. As far as I can see its coded correctly, its code lifted straight from the old framework (which runs side by side with this one until the transition is complete. There are no code duplications as old code is removed as new code is added). Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /www/allturf.co.uk/admin/framework.php on line 194 is the error. heres the code at fault: function new_page($title, $text, $short_text, $lang) { global $date_time, $uni_gen; $text = strip_html($text); $insertSQL = sprintf("INSERT INTO pages (lang, p1, p2, title, uni_id, date_time) VALUES (%s, %s, %s, %s, %s, %s)", GetSQLValueString($lang, "text"), GetSQLValueString($short_text, "text"), GetSQLValueString($text, "text"), GetSQLValueString($title, "text"), GetSQLValueString($uni_gen, "text"), GetSQLValueString($date_time, "text")); mysql_select_db($database_sql, $sql); $result = mysql_query($insertSQL, $sql) or die(mysql_error()); if ($result) { return true; } }
  14. that's the one! Ta very much!!
  15. a way of doing it could be done neatly is this maybe? if(isset($_GET['id']) && is_numeric($_GET['id'])){ ++$trigger; } if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage'])) { ++$trigger; } if ($trigger == 2) { // Whatever you want it to do here } I know its a few more lines but on quick summary its easy to read and keeps your coding nice and neat :-)
  16. I'm not sure if its a php or an apache thing, its not landing because you can do multiple ones, ie; http://domain.com/?id=121223 becomes http://domain.com/home http://domain.com/?id=548854 becomes http://domain.com/about http://domain.com/?id=875547 becomes http://domain.com/products and so on... cant for the life of me remember what its called but its really bugging me now!
  17. Hi, I've fotgotten what it is called where you have like 'forwarding' url aliases, and it is something a client wants on their site. For example, instead of having 'http://domain.com/index.php?this=that&another=value' you can set something like 'http://domain.com/about' instead, and it will do the same thing. I've only ever touched on it in the past a couple of times, but for the life of me cannot remember what it is called, and therefore can't google it! Any ideas? Hope it makes sense!
  18. Hi. Even if you were to cloak your url, there's still the old 'right click' --> 'View Page Source' Your best bet is to disable right clicks on your site using some form of javascript solution, but the options to view source is still available in the menus somewhere. Just a suggestion to reduce the chances of peeps seeing code but I think viewing page source is something you can't completely stop people from doing. Your PHP code is never viewable through browsers because it stays serverside, so your creativity can't be exploited with ya web apps ;-)
  19. done it now thanks! I used htmlentities() as suggested just on links and it works a treat! Thanks DarkWater
  20. it didnt work, it just changed the document into something that would not validate at all. This is why I cant understand it because it seems to be coded correctly.
  21. Hi folks! I have the following script which generates a RSS xml document; // Update the XML file for Blog RSS mysql_select_db($database_sql, $sql); $query_all_blogs = "SELECT * FROM blog_posts ORDER BY blog_id DESC"; $all_blogs = mysql_query($query_all_blogs, $sql) or die(mysql_error()); $row_all_blogs = mysql_fetch_assoc($all_blogs); $totalRows_all_blogs = mysql_num_rows($all_blogs); $pre_desc = cut_text($row_all_blogs['text'], 200)."..."; $desc = strip_tags($pre_desc); $file = fopen($blog_xml, 'w'); $xml_head = "<?xml version=\"1.0\"?> <rss version=\"2.0\"> <channel> <title>".$company."'s Blog Powered by SJWright.co.uk Site Editor</title> <link>http://www.".$site."</link> <description>Find out what we've been up to!</description> <language>en-uK</language>\n"; fwrite($file, $xml_head); do { $xml_body = "<item> <title>".$row_all_blogs['title']."</title> <link>http://www.".$site."/?this_page=blog&id=".$row_all_blogs['uni_id']."</link> <description>".$desc."</description> </item>\n"; fwrite($file, $xml_body); } while ($row_all_blogs = mysql_fetch_assoc($all_blogs)); $xml_close = "</channel> </rss>"; fwrite($file, $xml_close); fclose($file); $success = $success."XML RSS File Generated Successfully"; The outputted file can be found at http://allturf.co.uk/xml/blog.xml When the documet is opened with firefox it doesnt list the items, and when I validate it using a W3C validator it fails but i cant see why. http://validator.w3.org/feed/check.cgi?url=http%3A%2F%2Fallturf.co.uk%2Fxml%2Fblog.xml Any ideas? This is my first go at XML and generating a XML document, apologies if the solution is a simple one.
  22. Thanks everyone, the final solution is what worked for me.
  23. Here's the full script in its entirity for this section of the back end: // Add Link to Database if ($_POST['a'] == 'add_link') { $url = $_POST['url']; $title = $_POST['title']; $uni_id = $_POST['uni_id']; $target = $_POST['target']; if ($title == '') { $error = $error.'A link title was not provided.<br />'; } else { ++$trigger; } if ($url == '') { $error = $error.'A link url was not provided.<br />'; } else if (eregi ($url, ^('http://') | ('https://') | ('ftp://'))) { ++$trigger; } else { $error = $error.'An invalid URL was posted.<br />'; } if ($trigger == 2) { $insertSQL = sprintf("INSERT INTO links (uni_id, title, target, url) VALUES (%s, %s, %s, %s)", GetSQLValueString($uni_id, "text"), GetSQLValueString($title, "text"), GetSQLValueString($target, "text"), GetSQLValueString($url, "text")); mysql_select_db($database_sql, $sql); $result = mysql_query($insertSQL, $sql) or die(mysql_error()); if ($result) { $success = $success.'Link added successfully.<br/>'; } } }
  24. Parse error: syntax error, unexpected '^' in /Library/WebServer/Documents/allturf.co.uk/admin/core.php on line 31 is what I got, no luck yet! thanks for the reply though...
×
×
  • 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.