עבור לתוכן
View in the app

A better way to browse. Learn more.

HWzone

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

צריך עזרה קטנה בהצגת דפים באתר PHP

Featured Replies

פורסם

יש לי קוד שמציג את התפריט מהMYSQL באמצעות השאילתה הזאת



function get_all_subjects() {
global $connection;
// get id and linkpage from page database
$sqlCommand="SELECT id,linklabel FROM pages ORDER BY pageorder ASC";
$query=mysql_query($sqlCommand,$connection) or die(mysql_error());




// Use returned data
$menuDisplay='';
while ($row= mysql_fetch_array($query)){
$pid=$row["id"];
$linklabel=$row["linklabel"];

$menuDisplay .='<li><a href="index.php?pid=' . $pid . '">' .$linklabel . '</a></li>';
}

return $menuDisplay;
}


וקוד שמציד את התוכן של אותו נושא באתר באמצעות השאילתה הזאת




function get_content(){
global $connection;
// determine whice page id to use in our query below
if(!$_GET['pid']){
$pageid='1';
}
else{
$pageid= preg_replace('#[^0-9]#i', '', $_GET['pid']);
}
// query the body section for the proper page

$sqlCommand="SELECT pagebody FROM pages WHERE id='$pageid' LIMIT 1";
$query=mysql_query($sqlCommand,$connection) or die(mysql_error());
while ($row=mysql_fetch_array($query)) {
$body=$row["pagebody"];
}
mysql_freeresult($query);
return $body;

}



עכשיו אני רוצה להתקדם ולעשות שבתוך הנושא יהיה תת נושאים ואז בלחיצה עליהם יהיה תוכן.

למשל דוגמא:

אם בתפריט הראשוני היה נושא שהוא "תמונות " , אז שברגע שלוחצים בתפריט על "תמונות" בתוכן האתר לא יפתחו תמונות אלא עוד תת נושאים "תמונות 01 " תמונות 02" וכו'.

ואז ברגע שלוחצים על אחד מהם יפתח תוכן התמונות.

אז יצרתי לי כבר עוד DATABASE שנקרא SUBֹ_PAGES ובתוכו יש לי SUBJECT_ID שאמור לאחד לי את כל אותם תת נושאים.

למשל כל ה"תמונות 01 " "תמונות 02" מקבלים SUBJECT_ID מספר 2.

השאלה שלי איך אני בונה את השאילתה ואיך אני מציג אותה באתר כמו שצריך

תודה.

פורסם

השאילתא שאתה שולח ל- mysql_query אמורה להיראות ככה (פחות או יותר):

select * from sub_pages where subject_id = $id

פורסם
  • מחבר

משהו כזה אמור לעבוד?





function get_undersub(){
global $connection;

$sqlCommand="SELECT * FREOM sub_pages WHERE subject_id = $id";
$query=mysql_query($sqlCommand,$connection) or die(mysql_error());

while ($row=mysql_fetch_assoc($query)) {
$body=$row["pagebody"];
}
mysql_freeresult($query);
return $body;



ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.