|
id page parent
1 index 0
2 about 1
3 products 1
4 cars 3
5 trucks 3
If you name the lookup the same as the real page minus the extension you can build any part of the pathway dynamically.
You will need an array to keep track of the full path at each part of the breadcrumb.
so the array would need to look like this
<?php
$bc_arr = array();
$depth_guage = 0;
$home_not_found=true;
$cur_pg_name = "";
while($home_not_found)
{
$sql = "select pr1.*, (select pr2.page from page_relations as pr2 where pr2.id=pr1.parent) as parrent_name, (select pr2.parent from page_relations as pr2 where pr2.id=pr1.parent) as grandparent from page_relations as pr1 where page='".$cur_pg_name."'";
$rst = mysql_query($sql) or die(mysql_error();
$row = mysql_fetch_row($rst);
if($row['grandparent']==0)
{
$home_not_found=false;
}
else
{
}
array_push($bc_arr,"<a href='".str_repeat("../",$depth_guage).$row['page'].".php'> > ".$row['page']."</a>");
$depth_guage++;
?>
once you are out of the loop that builds your breadcrumbs you can step back though it and echo the results.
again I have not tested this code, but it is the general idea on how I have done it in the past.
modified on Thursday, December 2, 2010 12:36 PM
|
|
|
|
|
Though you said that you don't have a site-map, does your site have a defined directory structure? For example, if you have a "news" module, are they in a directory like "/news/january/xxxx.php"? If that is the case, then you can use the request URI and explode it on the slashes. From there you can infer the breadcrumb depth. Of course, there are always exceptions, so I've used that in conjunction with a variable defined in an include file $breadcrumb, and then set that to be whatever breadcrumb I want. When it comes time to render it, I just check to see if that $breadcrumb variable is set. If it is not set, then use the directory structure, otherwise use the overridden value.
I'm sure there are many other ways, but this was quick and easy provided the directories make sense.
|
|
|
|
|
I have a HTML page which sends lots of field values(more than 100) to a PHP page to be INSERTed into Database.
Because of the huge number of fields, I decided to GET Variables and their values via Decoding URL. This works! But the problem is:
As it will be ECHOed, the Query is alright but the INSERT is not done!
It should be cited that I do manual INSERTing in this page, so there isn`t any problem with CONNECTION, DATABASE, TABLE and etc.!
plz help me! It is walking on my nerves!
Here is my PHP code:
__________________________________________________________
__________________________________________________________
Connection.php:
|
|
|
|
|
Two cents of advice:
1.
please show code in PRE tags, it improves readability, hence it will yield more or better replies.
2.
include error handling in all your code. (almost?) every MySQL function returns a result code, and when it is not OK you should call a function to get detailed reasons, as in:
$Results=mysql_query($query);
if (!$Results) die("DB Error in WriteQuery ($query)".mysql_error());
|
|
|
|
|
my best debug for get, post and/or session...
echo "<pre>";
print_r($_GET);
print_r($_POST);
print_r($_SESSION);
echo "</pre>";
place this near the top of you page and then run the page. you will get to see what is being sent/stored for the page and can then debug your code from there.
All the Best,
Chris J.
|
|
|
|
|
I am trying to submit a form on my page. It's proving to be a very difficult and frustrating task.
The problem is that there is no way of telling how many 'fields' will need to be submitted. The user might add 50 products to the cart, and make 30 changes to the quantities, or they might add 600 products to the cart and make 599 changes to the quantities (you never know), and with this website, the client is expecting high volume of sales so I need to be prepared for cases such as that.
I have a Table (a script that I bought) which has its own form tag for the data inside the table, however it uses GET not POST. And I am using:
foreach($_GET['items'] as $p=>$q)
{
}
But I dont know how to do this. I have tried hundreds of variations of the above snip and NOTHING has worked for me.
I have searched all ovver php.net, google and am out of ideas, and would greatly appreciate anyone's advice or help.
How can I update ALL form fields to the database?
Thanks
Edit:
The result of
print_r($_GET); is:
Array ( [ct_items_per_page] => 10 [ct_sort] => t_t_t_t [ct_page] => 1 [ct_search] => [ct_items_per_page_change] => all [ct_multiple_search] => Array ( [0] => [1] => [2] => [3] => ) [product] => M5 x 1 MTR Allthread (Grade 304 Unit Price) [items] => Array ( [1] => 45 ) )
Edit:
What else would work in my situation? Does anyone have any links/tutorials/articles? I cannot find anything anywhere. Are there other ways to submit all fields to a database?
modified on Monday, March 28, 2011 1:18 AM
|
|
|
|
|
can you post your form code?
|
|
|
|
|
my criteria is an user will paste the URL (an web page which got video) (eg: http://www.youtube.com/watch?v=hTgnDLWeeaM&feature=topvideos[^]) to a textbox and click on submit button, it will redirect to the other page to show the movie.
Normally when i want to embedd a video to my own webpage, i will just copy the embedded code and just paste it to my web page.
But I wonder, what are those steps to SEARCH and GET the embedded code by just submit an URL but not "embedded code" itself.
Or am I got an blind spot here, it is not necessary to get the embedded code in order to embed a video?
How am i going to embed video to my own page by an URL?
|
|
|
|
|
I wanted to implement payment gateway in which a user can accept all credit card and debiot card details for payment.
|
|
|
|
|
And you want us to wish you luck????
Ok here goes, good luck with it.
But seriously, what do you want to know. We need some information as to what you are getting stuck with. And keep in mind that you will have to partner up with a payment provider to be able to charge using credit card or debit card (like PayPal, GlobalCollect, Bibit, etc...)
Once you are approved by one of them I guess you can start implementing their API to process payments.
|
|
|
|
|
I want to convert php script to .exe have you any idea.Like simple script hello brother
<?php
echo "Hello Brother \r\n";
sleep(10);
?>
now convert it to exe
|
|
|
|
|
I think facebook has a php to exe coverter called Hip-Hop that is free to use. try a google search. I have read a few articles and it is supppose to have a large impact on the execution speed.
-- Chris J
|
|
|
|
|
I think you cant do this with php
you can use another language
|
|
|
|
|
|
|
Is there a way to send FILE post data through PHP code.
I found a code which send common POST data:
fputs($fp, "POST $path HTTP/1.1\r\n");
fputs($fp, "Host: $host\r\n");
fputs($fp, "Referer: $referer\r\n");
fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
fputs($fp, "Content-length: ". strlen($data) ."\r\n");
fputs($fp, "Connection: close\r\n\r\n");
fputs($fp, $data);
How do I send $_FILES data through POST. Is that posible?
|
|
|
|
|
they are referenced in a different variable...$_FILES.
But you need to have an input element of the type files in your post form first. So someething like
<form action='' method='post' enctype='application/x-www-form-urlencoded'>
Name: <input type='text' name='user'>
Img: <input type='file' name='pict'>
<input type='submit' name='action' value='Upload'>
</form>
You would access the form elements with...
$_POST['action'] for the submit button
$_POST['user'] for the user field
$_FILES['pict'] for the pict field. Keep in mind this is an array and has a number addition values. You can read more about that here http://www.php.net/manual/en/features.file-upload.php[^]
|
|
|
|
|
|
I've tried putting
header('Location: http://www.google.com/');
at the end of one of my scripts, but it won't redirect. If It's just
< ?php
header('Location: http://www.google.com/');
?>
it works fine. I need to be able to run some stuff before it redirects the page.
|
|
|
|
|
In the PHP documentation[^] it actually quotes:
php.net wrote: Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP.
Two solutions:
- Have it (the header) at the top of the page before you output anything to the browser.
- Use Output Buffering[^] to hold the output before it is sent to the browser.
If at first you don't succeed, you're not Chuck Norris.
|
|
|
|
|
One other option is to echo a document.write to add a javascript redirect..its a bit of a hack, but works....provided someone does not turn off js in their browser.
|
|
|
|
|
You can run stuffs before that but make sure you dont echo anything else before giving this redirect. For e.g. validation of usernames, or anything which should be done before any HTML tags or echo is done..
- Jay.
|
|
|
|
|
Hello !
I want to hire a coder for my site. I am making a site of family trees for everyone. For that I need a coder. Anyone interested in please leave a message.
Thank you!
|
|
|
|
|
Don't give up do you?
Re-read what you have previously been told in other threads in this forum and the Collaboration forum. And stop asking the same question as the answer will not change.
modified 1-Aug-19 21:02pm.
|
|
|
|
|
I know what I got ; no one will make it for you better to hire.
RIGHT ?
And I am paying for that not getting free .....
modified on Sunday, November 7, 2010 6:05 PM
|
|
|
|