-
Posts
4,362 -
Joined
-
Last visited
-
Days Won
11
Posts posted by Zane
-
-
set the require statement outside of the class, at the top of the page
then just call it like you would any other Class
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]But you can use the statement extends statement to "reuse" a class:[/quote]
not a good idea
you might not want one class to have the properties of another
only use extends when you need to .....literally extend from it
for instance if you made a Car class
and you decided to make a Motorcycle class also....
then you could logically EXTEND it onto CAR, maybe -
[!--coloro:#999999--][span style=\"color:#999999\"][!--/coloro--]Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/chris/public_html/index.php on line 199[!--colorc--][/span][!--/colorc--]
Your mysql_num_rows obviously failed which, according to your code, would skip the $dates creation
So you technically have no variable $dates if mysql_num_rows() failed explaining this error
[!--coloro:#C0C0C0--][span style=\"color:#C0C0C0\"][!--/coloro--]Warning: in_array(): Wrong datatype for second argument in /home/chris/public_html/index.php on line 253[!--colorc--][/span][!--/colorc--]
which you posted ...... many many times in a row
So the key is to fix your mysql_num_rows....
check your MySQL result resource...which is $query_archives, AKA your query
and make sure that your date field in your database is of the DATE/DATETIME datatype -
Here's some markup
that may help
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
// INSERT INTO cabinrates
[!--coloro:#FF9966--][span style=\"color:#FF9966\"][!--/coloro--]$num = 0; //You don't need a counter for a FOREACH[!--colorc--][/span][!--/colorc--]
foreach($cabins as $size => $cost){
$query2 = "INSERT INTO cabinrates (cabinname, cabinprice, tourid) VALUES ('$size', '$cost', '$tourid')";
$addcabins = sql($query2);
[!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]//I don't see the point of this next line especially if you're supressing the errors, just take it out
@mysql_affected_rows($addcabins);[!--colorc--][/span][!--/colorc--]
//Try echo out every SQL statement that's made just to check you're doing all of them
echo $query2 . "<br />\n";
[!--coloro:#FF9966--][span style=\"color:#FF9966\"][!--/coloro--]$num = $num + 1;[!--colorc--][/span][!--/colorc--]
}
[/quote]
another idea would be to put curly braces around you're variables when you use them in the query
[!--coloro:#3333FF--][span style=\"color:#3333FF\"][!--/coloro--]$query2 = "INSERT INTO cabinrates (cabinname, cabinprice, tourid) VALUES ('{$size}', '{$cost}', '{$tourid}')";[!--colorc--][/span][!--/colorc--] -
Does anyone know of a good tutorial on how to set up a slash username system
I'd hate to find out that it's actually done by creating folders for each user
but assuming that's hopefully not the case
is there a tutorial on this
I would think that it involves editing the 404.shtml file to send the name of the invalid directory to your PHP file.....but if that was it........the address bar would change.
Any clues? -
[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']UPDATE[/span] tablename SET yourfield [color=orange]=[/color] LOWER(yourfield) [!--sql2--][/div][!--sql3--]
-
instead of echo
use exec
simple as that
[code]exex($skin[content]);[/code] -
look at the exec() function
[a href=\"http://www.php.net/exec\" target=\"_blank\"]http://www.php.net/exec[/a]
-
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
....
....
....
how deos everyone here get ahold of there photo's[/quote]
was that whole post for that one question?
well, you can always ask permission from someone to use their photo's for editing
you don't necessarily have to buy all pics
also they're a few websites out there that offer open source images so to speak
I don't know any off hand
just try googling around -
So apparently $pingtime is only an array if the ping was successful
right?
so set an IF statement, or my favorite a ternary statement that does this
[code]echo is_array($pingtime)?"online":"offline";
[/code]
note that that would only display offline or online
this is a 3rd party script
it's being moved there
please post in the correct forum -
set the name of the selection box to an array like
<select name="names[]">
...
</select>
and put that along with your Create button in a form
set the form to POST or GET to the same page
then at the top of you're page check for that POST or GET value and create an array from that
E.G
[code]if(isset($_POST['names']))
$names = $_POST['names'];
[/code] -
[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']SELECT[/span] *, substring(store,1,1) [color=green]AS[/color] first_letter, [color=blue]count[/color](*) [color=green]AS[/color] store_cnt [color=green]FROM[/color] [color=orange]stores[/color] GROUP BY first_letter [color=green]ORDER BY[/color] store; [!--sql2--][/div][!--sql3--]
I'm not positive but I think if you put [b]SELECT [!--coloro:#FF0000--][span style=\"color:#FF0000\"][!--/coloro--]*[!--colorc--][/span][!--/colorc--][/b]
it just selects all the fields and ignores everything until the word FROM
so try putting in all the fields you want
along with the other to dynamic ones
or at least trying doing just this and see what happens
[!--sql--][div class=\'sqltop\']SQL[/div][div class=\'sqlmain\'][!--sql1--][span style=\'color:blue;font-weight:bold\']SELECT[/span] substring(store,1,1) [color=green]AS[/color] first_letter, [color=blue]count[/color](*) [color=green]AS[/color] store_cnt, name [color=green]FROM[/color] [color=orange]stores[/color] GROUP BY first_letter [color=green]ORDER BY[/color] store; [!--sql2--][/div][!--sql3--] -
I'm pretty sure this isn't possible in PHP, unless you refreshed the page when they pushed the button
but it could be done in AJAX, but you're array would be of Javascript rather than PHP -
you'd use regex for that...
and if you use fgets you'd run a loop
regexing each line, each iteration -
do want it to actually create an inline usuable array that you could use after the select box
or are you looking for the button to just create PHP code for you to copy and paste somewhere? -
mysql
in MySQL Help
PEAR DB is just a template system that uses PHP and MySQL
it isn't a language
you put in your MySQL server information
you give it the HTML template you want
and if you happen to know some more advanced coding strategies
you can implement them with the existing templates
I've only seen it once and as far as I know, it's probably easier to just not use it.
but that's just my opinion -
PHP source code cannot be grabbed unless the creator makes in available in a php-source MIME type
usually has the extension [b].phps[/b]
PHP means Hypertext PreProcessor...so think of it as an HTML generator
you make code to either logically make HTML code, or systematically make it.
If someone did you a program to steal a PHP file
like flashGet or getright
all they would attain is the preprocessed HTML
and as for your vocab questions
1.INT = a number type
2.NOT = self explanatory
3.NULL = nothing
4.AUTO INCREMENT = increment by one for every row -
Same here, although I'm like a grammar Nazi.
I'm pretty considerate when it comes to someones question, I see no point in changing the subject to something stupid like a mispelled word rather than their main perogative.
I speak both spanish and english so I know how hard it can be to sound...not foreign, in the spanish perspective for me.
like ober said, if you can get [b]your[/b] idea of a [b]question across[/b] in whatever words it takes, it will be answered. -
this would be the regex for it
[code]ereg_replace("<a.*mailto:(.*)".*>(.*)</a>", "<a href="<?=$offset?>/mail.php?email=\\1">\\2</a>", $matches);
[/code] -
you need to merge your background into one image
you just need a line about 1024px wide
and maybe 5px tall
then you can do this
[code] body{
font-family: Trebuchet MS, Lucida Sans Unicode, Arial, sans-serif;
font-size:0.5em;
margin:0px;
padding:0px;
text-align:center;
background-image: url("background.jpg");
background-repeat: repeat-y;
align:left;
}[/code] -
you'd do it this way...for dynamic variables
[code]$arrays = "graphValues" . $c;
$$arrays[]=$row['RATING'];[/code]
but yeah kenrbnsn is right
a multi-dim array would work more smoothly -
you could much easier do the IF in the query itself like so
[code]
$sql = "
IF ( SELECT name FROM bUser where name = '$name' IS NULL ) THEN
INSERT INTO bUser Values ('$name','$mail');
ELSE
UPDATE bUser SET email = '$mail' where name = '$name';
END IF;
";
mysql_query($sql);[/code]
I think that should work -
you can get a zip code database here
[a href=\"http://civicspacelabs.org/home/releases/civicspace/civicspace-0.8.3.zip\" target=\"_blank\"]http://civicspacelabs.org/home/releases/ci...space-0.8.3.zip[/a]
download it, extract it, and look through the folders for the zipcodes.sql file or something like that
you'll have to INSERT them like 400 to 600 at a time on your MySQL server
depending on your CPU speed.
but that's a place to find the zipcodes
and there a plenty of free script templates for distance
most all free
it's about 7 or so lines of code -
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]do you mean creating a function on-the-fly???[/quote]
I think he means that he wants to call functions from within a function
just do it like you think you would
[code]
function Test() {
return "function 1";
}
function Test2() {
return "function 2";
}
function MainFunction() {
$msg = Test();
$msg .= Test2();
return $msg;
}
echo Main();
//returns function 1function2
[/code] -
try doing it like this
$sql = mysql_query("INSERT INTO elemento ( ele_tec, valor, id_potencia) values ('[b]{$ele_tec}[/b]', '[b]{$valor}[/b]','[b]{$id_potencia}[/b]')");
note the curly braces
Form Validation
in PHP Coding Help
Posted
if (empty($section)){
$error = "** You forgot to enter the section for the story! **<br>";
} else if (empty($added_by)){
$error = "** Error: You forgot to who added the story! **<br>";
} else if (empty($headline)){
$error = "** Error: You forgot to enter a headline for the story! **<br>";
} else if (empty($byline_name)){
$error = "** Error: You forgot to enter a byline name for the story! **<br>";
} else if (empty($published)){
$error = "** Error: You forgot to the date you wish to publish the story! **<br>";
} else if (empty($opening)){
$error = "** Error: You forgot to the Opening Paragraph for the Indexes! **<br>";
} else if (empty($body_text)){
$error = "** Error: You forgot to enter any body text! **<br>";}; [/code]
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]how do I get that message to appear...................IF all the fields are not filled[/quote]
don't use else if
just if
and make $error an associative array
like so
[code]
$error = array();
if (empty($section))
$error['section'] = "** You forgot to enter the section for the story! **<br>";
if (empty($added_by))
$error['added_by'] = "** Error: You forgot to who added the story! **<br>";
if (empty($headline))
$error['headline'] = "** Error: You forgot to enter a headline for the story! **<br>";
if (empty($byline_name))
$error['byline_name'] = "** Error: You forgot to enter a byline name for the story! **<br>";
[/code]