Jump to content

phpology

Members
  • Posts

    15
  • Joined

  • Last visited

Posts posted by phpology

  1. after you have opened your connection to your database, run this query also if you are not doing it already:

    mysql_query("SET NAMES 'utf8'"); //should only call once during life of connection.

     

    Also assuming you got the meta tag in placed to:

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

  2. You would need to go through your recordset and write the links yourself when you are looping:

    while($result = mysql_fetch_array($recordset))
    {
    echo "<a href=\"cities.php?country_id=".$result['id']."\">".$result['country_name']."</a>\n";
    }

     

    when cities.php is opened you then run another query to get the list of cities based on that country id.

    You could do it all inline i.e. without jumping to another php page using jquery/ajax but that is your call.

     

    or what you can do is create a 3d array where you combine all your results in one array but I am guessing there is going to be loads of data so this method might not be that useful.

  3. while($row = mysql_fetch_array($result))
    {					
    $data_array[] = $row;
    }
    
    //now what you can do is use that $data_array where you want in that page
    if(count($data_array) > 0)
    {
    foreach($data_array as $data)
    {
    	echo $data['col_name1'];
    	echo $data['col_name2']; //etc, etc
    }
    }

  4. I agree with Pikachu2000 with the timestamp of creation but are you also not planning to have a general date of the article too? a d/m/Y format which the user controls and the news is ordered by that.

     

    Generally, you should show 5/10 items and have view archive or something which shows all.

     

    Or add in a trigger field to mark it as archived. But probably making it "complicated" as that is a manual process after.

  5. try using a hashtag i.e. <a name="r-u-sure"></a> and place that clsoe to your confirmation area

    When you repload your page add in #r-u-sure at the end of your url like this: repload.php#r-u-sure.

     

    Why dont you use javascript confirm() to ask for confirmation when deleting?

  6. Dont see it being an issue to be honest but you should think about adding an error tracker maybe, in case it fails or your script breaks with malformed email addresses (make sure its a valid format when they save an event).

    Actually increase your script time out in case you are sending out loads of emails during that time frame.

    set_time_limit()

     

    something to think about - make sure you index your datetime column too so you get faster data retrieval

  7. in your select list example you have added an attribute called value which does not work with select lists as its assigned to the option.

    if you want your option to be selected based on your db value you need to do an if-else within each option something along the lines of this

    <option value="Fall 2010" <?php if($ship_season == "Fall 2010") {echo " selected"; }?>>Fall 2010</option>                    
    <option value="Spring 2010"<?php if($ship_season == "Spring 2010") {echo " selected"; }?>>Spring 2010</option>                    
    <option value="Fall 2011"<?php if($ship_season == "Fall 2011") {echo " selected"; }?>>Fall 2011</option>                    
    <option value="Spring 2011"<?php if($ship_season == "Spring 2011") {echo " selected"; }?>>Spring 2011</option>

     

     

    if you were generating your selectlist options via a db then it would be a lot cleaner to be honest as then you dont have to hardcode each option like the above.

     

    hope this helps

×
×
  • 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.