redbullmarky
Staff Alumni-
Posts
2,863 -
Joined
-
Last visited
Never
Everything posted by redbullmarky
-
you need an extra bracket here: [code] else { include("Login.php"); } } <------ here [/code]
-
Transfering data from one server to another
redbullmarky replied to Gruzin's topic in PHP Coding Help
yes, both php and both named after the server they'd go on. obviously how much you use this would depend on the nature of the data you're exchanging - for example, you wouldnt want to use something like this on a 'users' table, etc and you might still want to put something in place that would only allow access to serverA.php if called from serverB.php, and not direct access. still, should set you on your way ;) -
Transfering data from one server to another
redbullmarky replied to Gruzin's topic in PHP Coding Help
well you dont really need to follow the strict rules of XML/RSS to get you started, so you could literally have somethign quite simple that just echo's out the fields serverA.php [code] <?php $id = $_GET['id']; $query = "SELECT a,b,c FROM mytable WHERE id = '$id'"; $records = query stuff to get your records foreach($records as $record) { echo "{$record['a']},{$record['b']},{$record['c']}\n"; } ?> [/code] serverB.php [code] <?php $contents = file_get_contents("http://serverA.com/serverA.php?id=2"); $records = explode("\n", $contents); foreach($records as $record) { list($a, $b, $c) = explode(',', $record); echo "a=$a, b=$b, c=$c <br />"; } ?> [/code] quick and dirty, and possibly many many better ways - but should give you an idea. cheers -
Transfering data from one server to another
redbullmarky replied to Gruzin's topic in PHP Coding Help
if it's in realtime, you could set up an XML API-type thing on server A (like RSS would work) and parse the info on server B... -
try indending your code a little better and checking again. i had a little go but got lost very easily.... when the code enclosed between two brackets is quite long, i always find it useful to put a comment after the closing bracket, such as "// end for" or "// end if" etc, sometimes even more descriptive so i know exactly what for/if/while, etc, i'm closing. in this case, it'd help you out alot. i've never come across that error before, other than a missing bracket.
-
i've not seen anything on it apart from rumoured features (http://www.itwriting.com/blog/?postid=451) but agreed, it is a bit nasty when you buy a product and a very short time later the new version comes out for pretty much the same price. As the versions are getting higher though, "essential" features are kinda getting much less - so DW9 seems to be suggesting that AJAX/Blog support will be built in, but I dont reckon that'd be enough to get me in.
-
textareas dont work the same way as normal input fields. try this: [code] <textarea rows='5' id='compNote' name='compNote' tabindex='14'><?php echo $data_array["compNote"] ?></textarea> [/code]
-
a google search for '[url=http://www.google.co.uk/search?client=firefox-a&rls=org.mozilla%3Aen-GB%3Aofficial&channel=s&hl=en&q=syntax+highlight+php&meta=&btnG=Google+Search]syntax highlight php[/url]' came up with: http://qbnz.com/highlighter/ you might want to look at some of the other results there, too...
-
it does need a general tidy up, and as has been mentioned, the dog picture needs to be something more relevent to what you're doing. overall, it just seems a little bland and needs more to keep a potential user interested. Also, there is no "proper" validation on your forms.
-
to be honest, this probably IS a job for regular expressions, not the tokenizer - especially as you state that it'll not just be PHP code that's highlighted. the tokenizer functions mentioned previously here are relevent to PHP tokens only and not, for example, Perl, C, ASP, etc, etc.
-
change this line: [code] mysql_query($query); [/code] to [code] $result = mysql_query($query) or die(mysql_error()); [/code] which should tell you if there's a problem with your query.
-
would the [url=http://uk2.php.net/manual/en/function.highlight-string.php]highlight_string[/url] function help for what you're trying to do?
-
to be honest, $_GET is going to be your best bet as ted states (though using $_SESSION would require a page reload of sorts anyway to set it, so not really feasible) do you have any specific reason for wanting to avoid $_GET?
-
then please - instead of just getting others to write the code and others to patch them up, you do yourself many many many favours if you actually took the time to understand the code like the rest of us. not being rude, ted - just that almost 99% of every question you have is regarding someone elses script.
-
ted - quick question - did you write this code yourself or is it a *cough* Third party script you're asking us to modify for you?
-
oops sorry. missed a bracket :( [code] if (!isset($_POST['btnList']) || is_null($_POST['btnList'])) [/code] as for the other error, try replacing the $PHP_SELF line with: [code] <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST"> [/code] [b]edit[/b] in fact, if you want the form to post to the CURRENT page, then you dont need to specify a value for action. just [code] <form action="" method="POST"> [/code] would do the same.
-
depending on your error level setting (error_reporting) in PHP, you may or may not get notices. They're not errors as such, but always still good practice to deal with them. In your case, you have assumed that $_POST['btnList'] exists and then just checked its value. try this instead: [code] if (!isset($_POST['btnList'] || is_null($_POST['btnList'])) [/code] which will carry out the action if it's null, as before, but will ALSO carry out the action if it isnt set at all. being NULL means that $_POST['btnList'] has been given no value, which isn't the same as the btnList key being set in the first place. hope that helps cheers
-
no worries. PS the solved mod was removed when the forum was upgraded but should be back soon ;)
-
actually, you'll have a problem still, as the last digit of $colvals will be a comma which will cause the query to throw a wobbly. try this instead: [code] $colvals = array(); foreach ($diff as $k => $v) { $colvals[] = $k . " = '" . $v; } $colvals = implode(', ', $colvals); [/code]
-
you need an extra dot to make sure that the string gets appended, not rewritten: [code] $colvals.= $k . " = '" . $v . "', "; [/code] (note the dot that is directly after $colvals) hope that helps cheers
-
ted, in this case, it seems the original use of date (ie, the function) is correct. i believe "Key" is a reserved word. You should try and avoid using SQL reserved words, but if you want to carry on in this case, enclose the 'Key' with backticks (` - normally the key directly to the left of the number 1). Also, remove the spaces between the single and double quote: [code] <?php $result=mysql_query("SELECT * FROM Announ.jan WHERE `Key` = '" .date('d'). "'") or die(mysql_error()); ?> [/code] that should help cheers
-
Snap with Daniel, though I use my own which is a kinda middle ground between both of them.
-
dude, telling someone to get someone else to write it isnt gonna help too much ;) what i'd suggest though, MSwanson - if you're getting any specific errors, try and post just the error and the code around it - that's a hell of alot of code to look through :) cheers
-
I need help with this darn registration script...
redbullmarky replied to LilDemon's topic in PHP Coding Help
to be honest, if you need help i'd rather do it here just like everyone else. unpaid help comes at the cost that everyone else can learn from the same subject... post your code here, else you might want to try the freelancer forum if you want some undivided attention. cheers -
I need help with this darn registration script...
redbullmarky replied to LilDemon's topic in PHP Coding Help
got some code?