Home     Articles & Projects     Products & Web Services     Forum

Forum

Value from database

Hi i am trying to do the following PHP

I want to get the value row from the field_id which = 35 and the user_id = $usid

The DB looks like this
id | user_id | field_id | value
3 63 35 russellharrower
4 53 35

if the user has no value i want to show an error message like
please update your profile.

if the user has a value i want it to print out the value.

$sql = "SELECT `value` FROM `jos_community_fields_values` WHERE `field_id` = 35 AND `user_id` = $usid";
$query = mysql_query($sql);
$sign = mysql_result($query);
print $sign;

TV timetable

Hi guys, i am trying to set up a TV guide just like the Yahoo TV guide. {link saved}

this is my TV guide
{link saved}

I am trying to figure out how to do the html table.
I see the problem as
if i have a show starting at 3:00pm - which in the DB it is 15:00 then and it finish at 3:30pm - 15:30

how do show it as a 30min program so it finishes in between 3:00 and 4:00

and then the second program starts at 3:30 and finish at 5:00 how would i show that.

i see i cant really use tables? i guess i would have to use divs?

if anyone can help that would help.

Mysql auto increment id question

Hello David, I have searched everywhere on the net and could not find a quick solution, so I decided to turn to your forum, since every advice you have gave me up to now worked like a charm with PT.

Here is the situation:

I have a database of products with an auto increment ID field, so if I "ORDER BY ID DESC" I have a list of latest products displayed.

The DB gets a few hundred new products daily, and some other few hundreds of them get "expired" deleted from DB (also daily)

Now here is what I need to do:

I need to take an existing product and update its ID to the latest. - In other words, - delete the product from DB and than insert it back (with exactly the same values in all fields except its ID) so that it would get the latest ID and would be the first on the list.

I am capable of writing it the way I have explained above, but wanted to ask you, perhaps there is an easier way to update just the ID instead of deleting the entire product from DB and than to inserting it back just because I want to update its ID...

Any thoughts are welcome and appreciated! (as usual)

Thanks
Paul

Search Engine Friendly URLs for Universal Redirection Script

David,

Can you please give me either the PHP code or mod_rewrite code so that the Universal Redirection Script displays search engine friendly URLs.

Thanks,

Stephen

Problem With Output Display Of Links In My Menu.php On Site

I have a affiliate script developed that creates a mysql table and parse it into my site. My problem is on some sites using certain templates where my categories having 2 or more words, the categories are displayed correctly, but on other sites using the same script and menu.php code in the categories section of template the displayed words with 2 or more words have an "_" for the space between the words. I am wondering what would cause this. The css file or something within the php coding that works for some templates or sites but not others.

Connections not closing in MYSQL

Hello David,

Just wondering if you or anyone on your forum can answer this/solve this problem.

I've received the following from my hosting company where I have wordpress blog installed.

What this means is that wordpress is opening up a connection and then not closing it before the page request is complete. This leaves the connection open which in turn causes load issues. You will need to resolve this issue immediately or the account will need to be suspended again to prevent further server issues.

and

this account has recently been showing signs of causing stability problems on the server which appear to be due to mysql usage on the wordpress installation, it does not appear to be closing it's connections which are then hanging and causing problems for the rest of the server.

I've tried wordpress support and their stuck, unable to answer the problem,

Is there a way of running a script that will close all connections which I could possible use as a cron like every hour?

Thanks

Mally

Exit Link Conditional Statement

Hi
Is PHP able to check what url a site visitor goes on exit and then perform a conditional action based on that url that they are going to.

So for example if a visitor goes from my site to siteB, is there a php function that would recognise that a visitor was going to a certain url from my site and do something if that were true, but do nothing if false. I want something that recognises the goto exit url, rather than whether they click on a certain link, as some links I can not edit, but would still like to do something if the url of that link were to go to a certain place, but nothing if not.

Basically I am wondering whether php includes a function that checks the url a visitor is going to from my site, so that I can write a conditional script if they do that.

MySQL Database question

Hi David,

I have gone down the route of adding merchant details and voucher offers for merchants into the PT database. I have it working but wondered if I had done it in the simplist way or made it more compliacted than I needed to!

Fistly I added 2 tables

Voucher with the following fields
vouch_id
merch_id
name
description
deeplink
expires
submitted

merchants with the fields
merch_id
merchant
description
deeplink

to display a list of vouchers from a specific merchant, I first get the merchant info and then get the vouchers from that merchant

  $sql = "SELECT * FROM `".$config_databaseTablePrefix."merchants` WHERE merch_id = '".database_safe($_GET["merch_id"])."'";
  $result = database_querySelect($sql,$rows);
  $merchant = $rows[0];
 
  if ($result){
  print "<table>";     
  print "<tr>";   
  print "<td>".$merchant["merchant"]."</td>";
  print "<td>".$merchant["description"]."</td>";
  print "<td>".$merchant["deeplink"]."</td>";
  print "</tr>";
  print "</table>";
 
  $sql = "SELECT * FROM `".$config_databaseTablePrefix."vouchers` WHERE merch_id = '".database_safe($_GET["merch_id"])."'";
   
  print "<table>";  

  if (database_querySelect($sql,$rows))
  {
    foreach($rows as $vouchers)
    {
      print "<tr>";
      print "<td>".$vouchers["name"]."</td>";
      print "<td>".$vouchers["description"]."</td>";
      print "<td>".teaser($vouchers["deeplink"],50)."</td>";
      print "<td>".date("d M Y", $vouchers["expires"])."</td>";
      print "<td>".date("d M Y", $vouchers["submitted"])."</td>";
      print "</tr>";
    }
  }
 
  print "</table>";

Is there a simpler way to do this?

Thanks,
Simon

Date Time Selector

Hi David,

Is there an easy way to create a date / time selector. I am trying to input a future date/time into a mySQL database so that I can display entries which haven't expired.

Thanks,
Simon

Form query

Hi David,

Im after a little help as i have searched the net and cant find anything!

I want a form with drop down options (i can manage this) and each option would build part of the final url to visit.

so for example first option i pick fashion , so this would dictated the merchant , so this option would point to NEWLOOK.co.uk , then the second option i might have categories of clothing , so i pick jumpers , so the url will now point to NEWLOOK.co.uk/jumpers , and so on.

so would you know an easy way i could achieve this?

thanks in advance

Syndicate content