Jump to content

Vince889

Members
  • Posts

    65
  • Joined

  • Last visited

Posts posted by Vince889

  1. My guess would be that you haven't reset the paddings, only the margins, for the elements. Test it by exchanging the html, body from the top of ace.css with * and clear your cache.

    min-width seems to help in the ul element of the navbar

     

     

    Christian, I just tried your suggestion and it still wraps. Any other ideas?

    DarkerAngel, I tried that and it outputted this: (see attached).

     

    Vince

    post-67839-0-05428300-1350754403.txt

  2. Hey guys,

     

    Why exactly do people use multiplication when calculating time? Like when setting cookies, timeouts or something that requires second-based definitions.

     

    For example, some do:

    $thirty_days = time()+60*60*24*30;
    

     

    As opposed to what I do:

    $thirty_days = time()+2592000;
    

     

     

    Why do they do that? Does it help them calculate it without a calculator? Make it easier to manage/adjust in the future? Personal preference? These are the only possible explanations I can think of. This has been bugging me for a while...am I doing something wrong?

  3. I am more of a programmer, rather than a designer. I'd much rather code and make the website do cool things, as opposed to make it look pretty. In short, I suck at designing. Could you guys please critique the following website? Its for an industrial company that sells printers and related equipment.

     

    http://3dprintingequipment.com/landing/
    

     

    Being worked on:

    - An image rotator in the top-right corner of the screen.

    - The "Supplies" page. Please ignore this. I mainly want feedback on the landing page and the 'Products page'.

  4. how can i find reference to  something like this "navigationID=3" or "navigationID=44" within a string and then re write it to become something like this "/en/content/3/Link_Name"?

     

    there could be more than one reference within the string and the integer val (ie 3 and or 44) will not be known.

     

    Any help with this would be greatly appreciated.

     

    Regex would help, but if you want to use str_replace, thats fine.

     

    $string = "blahblah navigationID=44";
    
    $replacement = "/en/content/3/Link_Name";
    
    echo str_replace("navigationID=44",$replacement,$string);
    

     

    Atleast I think thats what you want...

  5. I learned something yesterday which I can share, when using variables in a double quoted string its wise to place {} around it.

    like:

    $name;
    echo "hello {$name}, how are you doing?";

    This is to avoid problems when parsing the code.

     

    Would this be much more logical?

     

    <?
    echo "Hello, I am ".$name."";
    ?>
    

     

    Or are they fairly the same?

  6. Hey PF. I'm trying to build some better coding habits, so what tips do you guys have? Of course there are obvious things such as well-commented code, neat structure, etc...

     

    But I'm looking for some more "TECHNICAL" tips that might be unspoken. For example, when is a good time to use a variable, opposed to a constant? I notice that a lot of programmers define their database settings with define(), while others just use a $variable. Is this personal preference or maybe its something I'm missing?

     

    I'm looking for ALL tips. Any information that you have, please share it. It will help make me (And anyone else reading this), a better coder.

    Thanks in advance.

     

    and if this is not the proper forum, please move it! =]

  7. Hi,

    I am a newbie to this forum and php as well.  I have a script which inserts data and image file into mysql database.  Now I want to display this image on web  page but unable to do it.  I tried a lot but couldn't find out any solution.  I would appreciate your help.

    <?php

     

    $con = mysql_connect("localhost", "root", "xx");

    if(!$con)

    {

    die('Could not connect:' .mysql_error());

    }

    mysql_select_db("yyy",$con);

     

    $memberid = '$_POST[memberid]';

    $fname = '$_POST[fname]';

    $lname = '$_POST[lname]';

    $gender= '$_POST[gender]';

    $add1 = '$_POST[add1]';

    $add2 = '$_POST[add2]';

    $city = '$_POST[city]';

    $state = '$_POST[state]';

    $zip = '$_POST[zip]';

    $country = '$_POST[country]';

     

    $photo1 = '$_FILES[image][name]';

    echo "$photo1";

     

    //if ($memberid= $_GET['memberid']){

    $query="select memberid,fname,lname,gender,add1,add2,city,state,zip,country,photo1 from vadhuvar_member where memberid =(select max(memberid)from vadhuvar_member)";

     

    $result=mysql_query($query) or die(mysql_error());

     

     

    while($row = mysql_fetch_assoc($result))

    {

    $memberid = $row['memberid'];

    $fname = $row['fname'];

    $lname = $row['lname'];

    $gender = $row['gender'];

    $add1 = $row['add1'];

    $add2 = $row['add2'];

    $city = $row['city'];

    $state = $row['state'];

    $zip = $row['zip'];

    $country = $row['country'];

    //$photo1=chunk_split(base64_encode($photo1));

    $photo1 = $row['photo1'];

     

    //echo base64_encode($photo1);

     

     

    echo "Name:$fname $lname<br>";

    //echo "Name:$_POST[fname]$_POST[lname]<br>";

    echo "Gender:$gender<br>";

    echo "Address:$add1 $add2<br>";

    echo "$city $state $zip<br>";

    echo "$country<br>";

    //echo "<img src=".upload/$photo1 ." alt="" width="200" height="300" /><br />";

     

     

        }

    //}

    ?>

     

     

    <!--img src="<?php echo '.upload/$_FILES[image][name]?memberid=$row[memberid]'?>"alt="" width="200" height="300"/-->;

    <?php echo "<img src=". upload/$row[photo1]" alt="" width="200" height="300">";?>

    <!--img src="<?php echo ".\upload\$photo1" ?>" alt=""  width="200" height="300"/-->;

     

    <? set_magic_quotes_runtime(1); // turn back on ?>

    Thanks

    Smita

     

    You know... if you run that script, it should be spitting a bunch of errors at you. Try turning error_reporting on and that should be the key.

  8. Take a look here:

    http://answers.yahooapis.com/AnswersService/V1/questionSearch?appid=YahooDemo&query=test

     

    That is a generated XML file from Yahoo's API. If you take a look, it has a node titled "Question". With PHP, how can I loop through each "Question" node and grab all of it's children as well?

     

    I tried this code, but apparently it did not work:

     

    $req = "http://answers.yahooapis.com/AnswersService/V1/questionSearch?appid=YahooDemo&query=php";
    $res = file_get_contents($req);
    $xml = simplexml_load_string($res);
    
    foreach ($xml->xpath('//Question') as $question) { // "//question" means for each question node
      echo((string)$question['Subject']." - ".(string)$question['Content']); // you get all the child nodes in $question
    } 

  9. Hi there!

    I am wondering if anyone knows how to handle strings that contain form fields, so when the form is submitted the fields inside the string are updated.

     

    For example say i have the following $string:

    please enter your username: <input type=text size=50 name=username value=" ">

     

    When I display it on the browser, inside of a form, it displays the blank text field.

    Say the user enters a value in the text field, "John", and hits submit.

     

    I need the $string to be updated to the following:

    please enter your user name: <input type=text size=50 value="John">

     

    I know it sounds wierd but I need the form to be inside of the string!

     

    Thanks in advance for any help! :)

     

     

    I'm not understanding...

     

    you want the string to read this?

     

    $string = "please enter your user name: <input type=text size=50 value='John'>";
    

  10. Because the $row variable is being created within a conditional statement, it will only be created IF that statement is true.

    In the case, the $row variable will only be set IF  the numbers of rows DOES NOT equal zero. Obviously, the query is returning 0 and not setting your $row variable. <-- Ignore that, I misread.

     

    Its because you're referencing the $row variable before the $row variable even exists. The $row variable isn't defined until here:

    $row = mysql_fetch_assoc($retrieve);
    

     

    After that, assuming that the conditional statement succeeds, you can use it. Otherwise, if a variable has not been set/defined/exists prior to use, PHP will return an error.

  11. Okay... this one is kind of complicated... for me, anyways.But I will try to be as clear as possible.

     

    I am using PHP's SimpleXML plugin to handle this XML document generated from Yahoo's API. Incase you aren't familiar, Yahoo's API generates thisupon request.

     

    As you can see, the queries the Yahoo Answers database and returns some questions on "PHP". I need to loop through this document and grab the Subject, Content, Date, Link, and Chosen Answer nodes from each Question node. And of course, they will need to be stored in a variable for later echo'ing.

     

    I think XPath is what I should be doing, but I have no idea about how I should loop through it and target those specific nodes only.

     

    $req = "http://answers.yahooapis.com/AnswersService/V1/questionSearch?appid=YahooDemo&query=php";
    $res = file_get_contents($req);
    $xml = simplexml_load_string($res);

     

    That's about as far as I got. Can anyone help? Also, if I'm not clear enough, please let me know!

  12. Try this:

     

    <?php
    $s = array("blah.", "blah blah.", "more blah.");
    $rand = array_rand($s);
    echo $s[$rand];
    ?>

     

    Excellent, man. It works. Thank you very much.. solved :]

     

    And Pickachu, you're right as well. Don't mind me i'm in my own little worldddd. Sorry for wasting you folk's time.

  13. I should know this, but i'm having a bad day.  :(

     

    If I have:

     

    		$s = array();	
    	$s[0] = "blah.";
    	$s[1] = "blah blah.";
    	$s[2] = "more blah.";
    
    
    	echo array_rand($s,1);

     

    Why it return a random number and a warning:

    Warning: array_rand() [function.array-rand]: First argument has to be an array in [filename here] on line 140

     

    I'm just trying to pull a random element from the array without using a complex formula. Now I've done this before but damn, like I said, my day has been full of sh*t.

     

    Any help would be appreciated.

  14. Thats excellent work, man! Thank you so much. That had been giving me a headache for a while... and I kept putting it off.

     

    One thing though, is it possible to make it stretch across the entire screen?

    I tried changing the widths from pixels to percentages, but that failed. =\ Would it be best to just increase the pixels and just hope that the user is viewing it in that resolution?

     

    Or even better, is there a way to make it stretch across the entire screen, but won't break if the user has a smaller resolution? Instead, it will just automatically adjust? (without a nasty horizontal scrollbar or something)

     

     

  15. Can someone please help me out with this? I've been trying really really to make this layout, and its like... killing me.

     

    It has to be in DIVS, no borders, solid background color. Gotta be compatible with modern browsers. Can someone please help me out or atleast steer me in the correct direction... so that I can atleast get started or something?

     

    Edit: would tables be easier?

     

    [attachment deleted by admin]

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