Jump to content

dannyb785

Members
  • Posts

    544
  • Joined

  • Last visited

Posts posted by dannyb785

  1. How does posting first justify it? And if you read, correctly. I wasn't suggesting his code. You didn't provide any evident help which could prove useful to the person asking the question, it's not exactly considered as a contribution. And by idiotic I meant your attitude, alright yes, you made a point which could have been put across better. But you didn't provide a solution. All in all, he didn't use the original method I proposed so therefore, discussion closed.

     

     

    How about my input being ignored? I said that if you're trying to grab pure php code from a php file off of a server, you can't do it. How much better does it need to be put across? I didn't provide a solution bc there wasn't one.

  2.  

    I want to put it on a link.

    How do put your code in this link below:

    <li><u><font color="#EEE"><a href='news1.html'>Investment Advisory Board Launched </a></font></u></li><br>
    

     

     

    Regards,

    Joseph

     

     

    you'd do

    <a href='news1.html' onClick="window.open('viewimage.php?id=64','mywindow','scrollbars=yes,width=WIDTH,height=HEIGHT')">
    

  3. No offense dannyb785, but you're criticizing peoples code and their efforts to help this person. Yet what exactly have you contributed? Apart from idiotic criticism.

    If you're going to do that, make sure it's constructive criticism which will help people better their programming skills. Not everybody has an extensive experience.

     

    Hey wolphie, wanna show me where I was idiotic? Also, show me where I told him his code was wrong. His code performs a task. I didn't think, based on the initial question, that the code provided performed the task requested. I was the first person to reply and post help! That's what I contributed. I also contributed the fact that you can't gather php code from a php file uploaded to a server just by running a fopen script.

  4. Dude, remember what i said about using the AS in your query? First off, you aren't grabbing any data from row['ammo'], $row['bank'], $row['money'], $row['titanium'], or $row['uranium'].

     

    Secondly, I wasn't clear about the AS. you need to have and AS for each variable you're getting. So in your case, you'd do "SELECT SUM(ammo) as ammosum,SUM(bank) as banksum, etc..."

     

    then after your $result is fetched, you have $row['ammosum'], $row['banksum'], etc...

     

    So basically, you're dividing by zero because $economy has no value(so by default, a zero is used) since there are no values in $row['ammo] and so on.

  5. Except showing <?php i upload to server. read another file in that file.

    and works.

    may be he want to show all the code and with breaks.so has to do extra coding for that.

     

     

    you didn't answer my question. Is the file a valid .php file, and you are using fopen to read the php code?

  6. cleary1981, i would assume you didn't name your connection $conn. Either way, mysql_close is pretty unnecessary -- php will close the link at the end of the script for you.

     

    danny, i do agree that it makes things clear. It's something i used to do, but am beginning to drop. I usually find that correct capitalisation is sufficient for me to follow the query. That said, if things start getting more complex, i do tend to add the backticks back in.

     

    what are backticks?

  7. the part without the "a" colors the text(and anything else that doesnt already have a specified color. and the "a" part colors the link.

     

    Think of it like a html tag. If it was a b instead of an a, then all bolds(since the tag is < b > ) would be that color.

  8. I have so many if and else statements in the script, I do not know what to do.

     

     

     

    That's because you're trying to output an entirely different page depending on what variables are what value.

     

    I don't understand... they put the right password and they are redirected to the registration page? Isn't that before registering??

  9. I didn't quite understand why I was doing that. I just tried adapting code from a book to suit mine. I made the change you suggested and got the following error.

     

    Parse error: syntax error, unexpected T_VARIABLE in C:\wamp\www\lookupdescription.php on line 9

     

    heres my new code

     

    <?php
    
    require "config.php";
    
    
    $model = preg_replace("/[\. \(\)\-]/", "", $_REQUEST['model']);
    $select = 'SELECT mod_desc';
    $from = ' FROM module';
    $where = ' WHERE type = '$model';
    
    $queryResult = mysql_query($select . $from . $where) or die("Error!".mysql_error());
    
    echo $queryResult;
    
    
    mysql_close($conn);
    ?>

     

     

    *slightly upset* you didn't do the code exactly as I typed it... check it again

  10. may be i misinterpret him,but if you want to show the code, of course not in html form. then Wolphie code is correct.

    try it yourself.

    just tried:

    $sql="SELECT * FROM xyz where active ='0'"; $q=mysql_query($sql); $num=mysql_num_rows($q); while ($row = mysql_fetch_object($q)) { $id=$row->id; $ch1=$row->ch1; $ch2=$row->ch2; $ch3=$row->ch3; $chp1_2_3=$row->chp1_2_3; $active=$row->active; echo $id; $sql1="update xyz set active='1' where id='$id'"; $q2=mysql_query($sql1); } ?>

     

     

    did you have a beginning <?php in that code? And did you upload it to a server in .php format? And when you ran the script, did it read the php code or the output in html format? I know what the answer is. Neither of us are wrong in this thread, we are just both interpreting the guy's question differently. There is no [easy] way to get pure php code from a .php file(if that's what he's asking)

  11. Ok the way you did it wayyyy crazy. Your problem is not having a '.' after $model. But the problem is bigger than that. You need cleaner code. Not only so you can do things easier, but you can find errors better and others can see your code and help you out.

     

    Here's a better way to do what you're doing:

    $where = " WHERE type = '$model' ";
    

     

    Though I will say that the way you do it by breaking it up into 3 variables is very unnecessary and if anything takes up more resources by using 3 variables when you really don't even need one. Just put the entire string into the query by itself.

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